dec2pos.m
来自「一个关于数据聚类和模式识别的程序,在生物化学,化学中因该都可以用到.希望对大家有」· M 代码 · 共 20 行
M
20 行
function [input, class] = dec2pos(data);
%DEC2POS Output data transformation
% [INPUT, CLASS] = DEC2POS(DATA)
% DATA is input plus output; the output is the last column of DATA
% (The output takes value from 1 to n, where n is the total number
% of classes.)
% INPUT is DATA(:, 1:end-1);
% CLASS is position representation of the last column of DATA
% (The size of CLASS is data_nxn.)
data_n = size(data, 1);
class_n = max(data(:,end));
input = data(:, 1:end-1);
class = zeros(data_n, class_n);
for i = 1:class_n,
index = find(data(:,end)==i);
class(index, i) = 1;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?