Saving and loading a Multiclass SVM Model

I want to save a trained multiclass SVM and then load it to make predictions. How to do this?

 採用された回答

Stephan
Stephan 2018 年 7 月 2 日
編集済み: Stephan 2018 年 7 月 2 日

0 投票

Hi,
save the workspace with the trained model in it. If you want to make predictions in later matlab sessions just load the corresponding .mat-file with your model and add the new data to workspace for that you want to make predictions.
The prediction itself is done with the
label = predict(SVMModel,X)
command, where X is your data set on which you want to make a new prediction. See the documentation for predict command for examples how to do.
Best regards
Stephan

3 件のコメント

NC
NC 2018 年 7 月 2 日
Thank you very much. But I can't save the model with "saveCompactModel()" function. How to save it ?
Stephan
Stephan 2018 年 7 月 2 日
編集済み: Stephan 2018 年 7 月 2 日
Hi,
this should work like this:
saveCompactModel(SVMModel, 'your_filename');
Where SVMModel is the name of your model and your_filename means the wanted name of the .mat-file containing your model. If you dont want it to be saved in the actual working folder, specify the full path like
'C:\Projects\SVM\my_svm_model'
Do you have full rights fo write into the matlab working folder?
See saveCompactModel documentation for more information.
Ravi Singh
Ravi Singh 2020 年 3 月 19 日
Hi stephen,
The code you provided to save is not working. Do we have something else to save.

サインインしてコメントする。

その他の回答 (0 件)

タグ

質問済み:

NC
2018 年 7 月 2 日

コメント済み:

2020 年 3 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by