In the Support Vector Regression, where can i see or identify the solved function?

3 views (last 30 days)
I want to plot the solved function, linear or nonlinear, so it would be great if someone can help me out where i can find this. And another question: In SVM Regression, how can i get information about the goodness of the fit, like the R-squared value?

Answers (1)

Darshan Ramakant Bhat
Darshan Ramakant Bhat on 6 Mar 2017
According to my understanding you are trying to plot the learned function from the svm regression. You can do this by accessing the parameters of the returned model.You can plot maximum upto 3D. A pseudo code can like follows.
Mdl = fitrsvm(X,Y);
Y_response = (1/(mdl.KernelParameters.Scale))*X*mdl.Beta+mdl.Bias;
plot(X,Y_response) %use appropriate plot function 2-D or 3-D
To get the regression value you can use the loss() function. I think following documentation would help you
Regards
Darshan Bhat
  1 Comment
Sebastian Kaufmann
Sebastian Kaufmann on 10 Mar 2017
Thank you for your great help, this code works perfectly for plotting a linear Regression, but when i want to try a nonlinear Kernel like this:
SVMR = fitrsvm(X,y,'KernelFunction','polynomial');
Y_response =(1/(SVMR.KernelParameters.Scale))*X*SVMR.Beta+SVMR.Bias;
i am getting the following error: "Error using * Inner matrix dimensions must agree."
Can you maybe help me with this? Would be so kind.
And the loss function is the only way to get a value of the goodness of the fit?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!