I. Source code

Tic % timer %% Clear the environment variable close all clear CLC %format compact
 load('ISSL-Isomap.mat')% load CMPE original % mappedX=X; %% zc=mappedX(1:60, :); % feature input Lie =mappedX(61:120, :); mo=mappedX(121:180, :); que=mappedX(181:240, :); duan=mappedX(241:300, :); mm=size(zc,1);
nn=20;
 
a=ones(mm,1); % behavior sample size b=2*ones(mm,1);
c=3*ones(mm,1);
d=4*ones(mm,1);
f=5*ones(mm,1);
 
n1=randperm(size(zc,1));
n2=randperm(size(lie,1));
n3=randperm(size(mo,1));
n4=randperm(size(que,1));
n5=randperm(size(duan,1));
 
train_wine = [zc(n1(1:nn),:); lie(n2(1:nn),:); mo(n3(1:nn),:); que(n4(1:nn),:); duan(n5(1:nn),:)]; Train_wine_labels = [a() train_wine_labels = [a()1:nn,:); b(1:nn,:); c(1:nn,:); d(1:nn,:); f(1:nn,:)]; % will be the first category3159Of the second kind96- 130.And the third category154- 178.As a test set test_wine = [zc(n1((nn+1):mm),:); lie(n2((nn+1):mm),:); mo(n3((nn+1):mm),:); que(n4((nn+1):mm),:); duan(n5((nn+1):mm),:)]; % the corresponding test set labels should also be separated out test_wine_labels = [a((nn+)1):mm,:); b((nn+1):mm,:); c((nn+1):mm,:); d((nn+1):mm,:); f((nn+1):mm,:)]; %% data preprocessing % data preprocessing, normalized the training set and test set to [0.1[mtrain,ntrain] = size(train_wine); [mtest,ntest] = size(test_wine); dataset = [train_wine;test_wine]; % mapminmax is the normalized function [DATASet_scale,ps] = mapminmax(dataset'.0.1);
dataset_scale = dataset_scale';
 
train_wine = dataset_scale(1:mtrain,:);
test_wine = dataset_scale( (mtrain+1):(mtrain+mtest),: ); %% Default Parameters Default parameter n=10;      % Population size, typically10 to 40
N_gen=150;  % Number of generations
A=0.5;      % Loudness  (constant or decreasing)
r=0.5;      % Pulse rate (constant or decreasing)
% This frequency range determines the scalings
% You should change these values if necessary
Qmin=0;         % Frequency minimum
Qmax=2;         % Frequency maximum
% Iteration parameters
N_iter=0; % Total number of function evaluations % what does this mean? % Dimension of the search variables d=2;           % Number of dimensions 
% Lower limit/bounds/ a vector
Lb=[0.01.0.01]; % Lower bound Ub=[100.100]; % Initializing Arrays Q=zeros(n,1);   % Frequency
v=zeros(n,d);   % Velocities
% Initialize the population/solutions
 
% Output/display
disp(['Number of evaluations: ',num2str(N_iter)]);
disp(['Best =',num2str(best),' fmin=',num2str(fmin)]); SVM network training using the best parameters'-c ',num2str(best(:,1)),' -g ',num2str(best(:,2))]; model_gwosvm = svmtrain(train_wine_labels,train_wine,cmd_gwosvm); Predict_label = svmpredict(test_wine_labels,test_wine, model_gwosVM); total = length(test_wine_labels); % Print test set classification accuracy right = length(find(predict_label == test_wine_labels)); Accuracy=right/total; % disp('Printing test set classification accuracy');
% str = sprintf( 'Accuracy = %g%% (%d/%d)',accuracy(1),right,total); % disp(str); %% results analysis % actual classification and predicted classification of test sets figure; hold on; plot(test_wine_labels,'o');
plot(predict_label,'r*');
xlabel('Test set sample'.'FontSize'.12);
ylabel('Category label'.'FontSize'.12);
legend('Actual Test Set Classification'.'Predictive Test Set Classification');
title('Actual and predicted classification of test sets'.'FontSize'.12);
grid on
snapnow
 
figure
plot(1:N_gen,AAA);
Copy the code

Second, operation results

Third, note

Version: 2014 a