CSVM and SVM on 2 class dataset

2 次查看(过去 30 天)
alex
alex 2022-11-4
Hi I have this dataset ' pima-indians-diabetes' have 8 features with 2 classes (0 and 1)
and I wanna do svm and csvm on the third and sixth features but I can not draw the line and just plot support vectors
this is my code right now
clc
clear all
close all
datas = csvread('pima-indians-diabetes.csv');
f3=datas(1:1:768,3);
f6=datas(1:1:768,6);
X=[f3 f6];
Y=datas(1:1:768,9);
SVMModel = fitcsvm(X,Y)
sv = SVMModel.SupportVectors;
figure
gscatter(X(:,1),X(:,2),Y)
hold on
plot(sv(:,1),sv(:,2),'ko','MarkerSize',10)
legend('1','0','Support Vector')
hold off
and is fitcsvm is svm or csvm?if its csvm how to define c and if its not what sholud I use instead?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by