error in svm classifier
Show older comments
hello, I would like generate one class of points inside the unit disk in two dimensions, and another class of points in the annulus from radius 1 to radius 2. then, Train SVM Classifiers on this data. this line have error :ezpolar(@(x)1); I run this code in R2014a but it gives the error:
"Error using text Too many input arguments.
Error in ezpolar (line 74) text(0,-1.35*max(abs(RHO)),['r = ', texlabel(rho0)], ...
Error in svmme (line 16) ezpolar(@(x)1)"
this code is:
rng(1); % For reproducibility
r = sqrt(rand(100,1)); % Radius
t = 2*pi*rand(100,1); % Angle
data1 = [r.*cos(t), r.*sin(t)]; % Points
r2 = sqrt(3*rand(100,1)+1); % Radius
t2 = 2*pi*rand(100,1); % Angle
data2 = [r2.*cos(t2), r2.*sin(t2)]; % points
figure;
plot(data1(:,1),data1(:,2),'r.','MarkerSize',15)
hold on
plot(data2(:,1),data2(:,2),'b.','MarkerSize',15)
ezpolar(@(x)1);
ezpolar(@(x)2);
axis equal
hold off
data3 = [data1;data2];
theclass = ones(200,1);
theclass(1:100) = -1;
%Train the SVM Classifier
cl = fitcsvm(data3,theclass,'KernelFunction','rbf',...
'BoxConstraint',Inf,'ClassNames',[-1,1]);
1 Comment
Image Analyst
on 5 Jul 2018
Don't double space your code. Simply read this link to learn how to format it as code instead of ordinary text. Basically highlight and click {}Code.
Accepted Answer
More Answers (0)
Categories
Find more on Support Vector Machine Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!