📄 artmap_add_new_category.m
字号:
function [resizedWeight, resizedMapField] = ARTMAP_Add_New_Category(weight, mapField)
% ARTMAP_Add_New_Category Adds a new category to the given weight matrix and map field.
% [RESIZEDWEIGHT, RESIZEDMAPFIELD] = ARTMAP_Add_New_Category(WEIGHT, MAPFIELD)
% This function returns a new weight matrix which is identical to the
% given weight matrix except that it contains one more category which
% is initialized to all 1's. It also returns a new map field matrix
% which is identical to the given map field matrix except that it contains
% one more element initialized to 0.
%
% The input parameters are as follows:
% The WEIGHT is a matrix of size NumFeatures-by-NumCategories which
% holds the weights of the network. The MAPFIELD is a matrix of size
% 1-by-NumCategories which holds the associations between categories
% and classes.
%
% The return parameters are as follows:
% The RESIZEDWEIGHT is a matrix of size NumFeatures-by-NumCategories+1
% which holds the weights of the old matrix plus a new category of all
% values of 1. The RESIZEDMAPFIELD is a matrix of size 1-by-NumCategories+1
% which holds the given map field matrix except that it contains
% one more element initialized to 0.
% Make sure that the user specified the weight and map field matrices.
if(nargin ~= 2)
error('You must specify the weight and map field parameters.');
end
% Create the return weight matrix with the right dimensions.
[numFeatures, numCategories] = size(weight);
newCategory = ones(numFeatures, 1);
resizedWeight = [weight, newCategory];
% Create the return map field matrix with the right dimensions.
resizedMapField = [mapField, 0];
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -