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

4 ビュー (過去 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 Center および File ExchangeClassification Ensembles についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by