art_complement_code.m
来自「ART 神经网络Matlab代码。包括数据产生函数」· M 代码 · 共 40 行
M
40 行
function complementCodedData = ART_Complement_Code(data)
% ART_Complement_Code Complement codes the data for use with an ART network.
% COMPLEMENTCODEDDATA = ART_Complement_Code(DATA)
% This function complement codes the given data where the complement
% of x is 1-x. For example, suppose the data were as follows:
% data = 0.3 0.2 0.6
% 0.4 0.1 0.8
% Then the complement coding would be as follows:
% complementCodedData = 0.3 0.2 0.6
% 0.7 0.8 0.4
% 0.4 0.1 0.8
% 0.6 0.9 0.2
%
% The input parameters are as follows:
% The DATA is a matrix of size NumFeatures-by-NumSamples that holds
% the data to be complement coded. The complement coding works on
% each column (i.e., each sample).
%
% The return parameter is as follows:
% The COMPLEMENTCODEDDATA is the data that has been complement coded.
% It is a matrix of size 2*NumFeatures-by-NumSamples.
% Determine the size of the data.
[numFeatures, numSamples] = size(data);
% Create the return variable.
complementCodedData = ones(2*numFeatures, numSamples);
% Do the complement coding for each sample.
for j = 1:numSamples
count = 1;
for i = 1:2:(2*numFeatures)
complementCodedData(i, j) = data(count, j);
complementCodedData(i + 1, j) = 1 - data(count, j);
count = count + 1;
end
end
return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?