フィルターのクリア

How to draw an SVM regression plot

10 ビュー (過去 30 日間)
영훈 정
영훈 정 2023 年 9 月 13 日
回答済み: Drew 2023 年 9 月 13 日
As shown in the figure, I would like to draw a plot that includes the lines of the margin, support vector, and seperating hyperplane of the model.
However, even if I get a model using fitrsvm, I can't use the information in the support vector.
I need your help.
x = normrnd(10,1,1000,1);
y = x*3 + normrnd(10,1,1000,1);
hold on
Mdl = fitrsvm(x,y)
Mdl =
RegressionSVM ResponseName: 'Y' CategoricalPredictors: [] ResponseTransform: 'none' Alpha: [768×1 double] Bias: 10.6836 KernelParameters: [1×1 struct] NumObservations: 1000 BoxConstraints: [1000×1 double] ConvergenceInfo: [1×1 struct] IsSupportVector: [1000×1 logical] Solver: 'SMO' Properties, Methods
figure(1);scatter(x, y);
It's an example of a hand-drawn drawing. I want to draw something like this.

採用された回答

Drew
Drew 2023 年 9 月 13 日
The doc page
has several examples where the fitcsvm support vectors are circled in a gscatter plot, and the decision boundary is drawn using contour.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSupport Vector Machine Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by