error in svm classifier
显示 更早的评论
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 个评论
Image Analyst
2018-7-5
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Support Vector Machine Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
