资源简介
这是一个机器学习新算法-极限学习机的代码,里面有几个小例子,由南洋理工大学黄广斌教授边写
代码片段和文件信息
function [PTTV] = GetPTforSatimagedata
load sat_trn.dt;
load sat_tst.dt;
dataset(1:size(sat_trn1):)=sat_trn;
dataset(size(sat_trn1)+1:size(sat_trn1)+size(sat_tst1):)=sat_tst;
rand_sequence=randperm(size(dataset1));
temp_dataset=dataset;
dataset=temp_dataset(rand_sequence :);
for i=1:size(dataset2)-1
dataset(:i)=(dataset(:i)-min(dataset(:i)))/(max(dataset(:i))-min(dataset(:i)))*2-1;
end
P1=dataset(1:floor(size(dataset1)/2)1:size(dataset2)-1);
T1=dataset(1:floor(size(dataset1)/2)size(dataset2));
% P=P1‘;
% T=T1‘;
%Obtain Random Validation Matrix
X=dataset(floor(size(dataset1)/2)+1:size(dataset1)1:size(dataset2)-1);
Y=dataset(floor(size(dataset1)/2)+1:size(dataset1)size(dataset2));
% TV.P=X‘;
% TV.T=Y‘;
fid = fopen(‘sat_train‘‘w‘);
for i=1:size(P11)
fprintf(fid‘%2.8f ‘T1(i1));
for j=1:size(P12)
% fprintf(fid‘ %d:%2.8f‘j P1(ij)); % for SVM
fprintf(fid‘ %2.8f‘ P1(ij)); % for ELM
end
fprintf(fid‘\n‘);
end
fclose(fid);
fid = fopen(‘sat_test‘‘w‘);
for i=1:size(X1)
fprintf(fid‘%2.8f ‘Y(i1));
for j=1:size(X2)
% fprintf(fid‘ %d:%2.8f‘j X(ij)); % for SVM
fprintf(fid‘ %2.8f‘ X(ij)); % for ELM
end
fprintf(fid‘\n‘);
end
fclose(fid);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1563 2004-04-18 22:23 satimage_data.m
文件 1023 2004-04-17 23:16 satimage_mean.m
文件 525830 2003-02-14 16:24 sat_trn.dt
文件 236745 2003-02-14 16:24 sat_tst.dt
评论
共有 条评论