Fuzzy ART and Fuzzy ARTMAP Neural Networks
22 Dec 2003
24 Dec 2003)
This package allows creation, training, and testing of ART and ARTMAP neural networks.
|ART_Activate_Categories(input, weight, bias)
function categoryActivation = ART_Activate_Categories(input, weight, bias)
% ART_Activate_Categories Activates the categories in an ART network.
% CATEGORYACTIVATION = ART_Activate_Categories(INPUT, WEIGHT, BIAS)
% This function returns a vector of category activations for the given
% input vector, weight matrix, and bias value.
% The input parameters are as follows:
% The INPUT is a vector of size NumFeatures that contains the input
% signal into the network. The WEIGHT is a matrix of size
% NumFeatures-by-NumCategories which holds the weights of the network.
% The BIAS is the constant that is used to differentiate between very
% similar category activation values. The length of the INPUT vector
% must equal the number of rows in the WEIGHT matrix, and the BIAS
% value must be within the range [0, 1] (although values very near
% 0 are best).
% The return parameter is as follows:
% The CATEGORYACTIVATION is a vector of size NumCategories that
% holds the activation value for each category.
% Make sure the user supplied the required parameters.
if(nargin ~= 3)
error('You must specify the 3 input parameters.');
% Check the size and range of the parameters.
[numFeatures, numCategories] = size(weight);
if(length(input) ~= numFeatures)
error('The length of the input and rows of the weights do not match.');
if((bias < 0) | (bias > 1))
error('The bias must be within the range [0, 1].');
% Set up the return variable.
categoryActivation = ones(1, numCategories);
% Calculate the activation for each category.
% This is done according to the following equation:
% Activation(j) = |Input^Weight(j)| / (bias + |Weight(j)|)
for j = 1:numCategories
matchVector = min(input, weight(:, j));
weightLength = sum(weight(:, j));
categoryActivation(1, j) = sum(matchVector) / (bias + weightLength);