ELK520 Machine Learning

 

SVM Classification kodlari icin "spiral" pattern üreten kodlar:

alpha = 150;

B=3.5;

M=50;

x1 = [];y1 = [];

theta = pi/2;

while theta < B*pi;

   theta = theta + B*pi/M;

   rho = alpha*theta;

   x1 = [x1 ; rho*cos(theta)];

   y1 = [y1 ; rho*sin(theta)];

end;

x2=-x1;y2 =-y1;pattern = [x1 y1];

classe = zeros(size(x1,1),1);pattern = [pattern ; [x2 y2]];pattern = pattern/max(max(pattern));

pattern=pattern';classe = [classe ; ones(size(x2,1),1)]';classe=classe*2-1;

X=pattern;

r=classe;

clear p* c* x* y* a* t*

Menü