
3.5 The Kernel PCA 97
e=0;
end
end
t=sqrt(rˆ 2-sum(temp.ˆ 2))+noise_level*(rand-0.5);
qw=[temp t; temp -t]';
X=[X qw];
end
ThedatasetX
test
is generated similarly (use the value 100 as the seed for the rand function).
To define the class labels of the data vectors, type
[l,N]=size(X);
y=[ones(1,n_points(1)) -ones(1,n_points(2))];
y_test=[ones(1,n_points(1)) -ones(1,n_points(2))];
To pl ot the data set X, type
2
figure(1), plot3(X(1,y==1),X(2,y==1),X(3,y==1),'r.',...
X(1,y==-1),X(2,y==-1),X(3,y==-1),'b+')
figure(1), axis equal
X
test
is plotted similarly. Clearly, the two classes are nonlinearly separable.
Step 2. To perform kernel PCA with kernel exponent i al and ...