art_add_new_category.m
来自「ART 神经网络Matlab代码。包括数据产生函数」· M 代码 · 共 29 行
M
29 行
function resizedWeight = ART_Add_New_Category(weight)
% ART_Add_New_Category Adds a new category to the given weight matrix.
% RESIZEDWEIGHT = ART_Add_New_Category(WEIGHT)
% 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.
%
% The input parameter is as follows:
% The WEIGHT is a matrix of size NumFeatures-by-NumCategories which
% holds the weights of the network.
%
% The return parameter is 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.
% Make sure that the user specified the weight matrix.
if(nargin ~= 1)
error('You must specify the weight matrix parameter.');
end
% Create the return weight matrix with the right dimensions.
[numFeatures, numCategories] = size(weight);
newCategory = ones(numFeatures, 1);
resizedWeight = [weight, newCategory];
return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?