Clear Filters
Clear Filters

CSVM and SVM on 2 class dataset

4 views (last 30 days)
alex
alex on 4 Nov 2022
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?

Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!