What is the predict formula for fitrsvm (gaussian kernel) generated model?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Using fitrsvm, I have generated a model from X and Y data:
mdl = fitrsvm(X,Y,'Standardize',true,...
'KernelFunction','gaussian','KernelScale','auto');
Given an input x, the predicted output using Matlab is:
y_expected=predict(mdl,x);
My attempt below at replicating 'predict' function does not yield the correct answer as y and y_expected do not agree.
y=mdl.Bias;
for i=1:length(mdl.Alpha)
xmxd=x-mdl.SupportVectors(i,:);
y=y + mdl.Alpha(i)*exp(-xmxd*xmxd'/2/mdl.KernelParameters.Scale);
end
y
What is the underlying formula behind the predict function in this case? I need it to write equivalent java code from parameters in the mdl model.
1 commentaire
sanjeev kumar T M
le 12 Août 2018
Hello, Actually i tried with the predictive formula given above but am not able to get the result what am getting using predict function. if any one help me regarding this please. what formula i have to use because i want to use the model in microcontroller to validate. am using 4 predictors and am using gaussian kernel
Réponses (2)
the cyclist
le 18 Mai 2016
5 commentaires
the cyclist
le 19 Mai 2016
The best form of thanks is upvoting and/or accepting an answer that you find helpful. This rewards the contributor, and points future users to helpful answers.
antlhem
le 29 Mai 2021
Could take a look into my question? https://uk.mathworks.com/matlabcentral/answers/842800-why-matlab-svr-is-not-working-for-exponential-data-and-works-well-with-data-that-fluctuates?s_tid=prof_contriblnk
sanjeev kumar T M
le 12 Août 2018
Hello, Actually i tried with the predictive formula given above but am not able to get the result what am getting using predict function. if any one help me regarding this please. what formula i have to use because i want to use the model in microcontroller to validate.
Thanks,
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!