How can I find and plot the hyperplane to this simple dataset using SVM

조회 수: 6 (최근 30일)
Mojtaba Mohareri
Mojtaba Mohareri 2021년 5월 29일
댓글: Image Analyst 2021년 6월 2일
I have this simple dataset D={[(1,1),1],[(1,-1),1],[(-1,1),-1],[(-1,-1),-1]} in which 1 denotes red points and -1 shows blue points. How can I find the hyperplane by using SVM and plot it in matlab for this dataset? Does matlab gives me the equation of the hyperplane, as well?
Thanks in advance.

답변 (1개)

Image Analyst
Image Analyst 2021년 5월 29일
Did you try fitcsvm()? From the help:
Description
fitcsvm trains or cross-validates a support vector machine (SVM) model for one-class and two-class (binary) classification on a low-dimensional or moderate-dimensional predictor data set. fitcsvm supports mapping the predictor data using kernel functions, and supports sequential minimal optimization (SMO), iterative single data algorithm (ISDA), or L1 soft-margin minimization via quadratic programming for objective-function minimization.
To train a linear SVM model for binary classification on a high-dimensional data set, that is, a data set that includes many predictor variables, use fitclinear instead.
For multiclass learning with combined binary SVM models, use error-correcting output codes (ECOC). For more details, see fitcecoc.
To train an SVM regression model, see fitrsvm for low-dimensional and moderate-dimensional predictor data sets, or fitrlinear for high-dimensional data sets.
  댓글 수: 2
Mojtaba Mohareri
Mojtaba Mohareri 2021년 6월 2일
편집: Mojtaba Mohareri 2021년 6월 2일
Thank you very much for your explanation. I don't know matlab very much. Could you please send me a simple code I can use to classify my above data and find the hyperplane?
Thanks in advance.
Image Analyst
Image Analyst 2021년 6월 2일
Sorry, I don't have any SVM demos made up yet. I'd have to fumble through the documentation just like you will. I'm pretty sure the documentation includes examples like nearly all function documentation does.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Classification Ensembles에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by