How to use loss() function in SVM trained model
显示 更早的评论
I have 40*5 matrix 'tsetALLstd.CSV', file 1 to 4 columns represent as a predictor and 5th column represents response variables. I have attached file in here, I used machine learning toolbox for train SVM model using that 'tsetALLstd.CSV' file and I export it to my Matlab workspace.I need to calculate classification error in SVM how should I do it?

回答(1 个)
Hi
here you find an example with step by step how to for your problem:
Best regards
Stephan
5 个评论
Asanka Dewappriya
2018-5-5
Stephan
2018-5-5
In your case the name of the 5th column
Asanka Dewappriya
2018-5-5
Stephan
2018-5-6
Please send your .mat file containing O and trained model. Also please send your code you have tried.
Best regards
Stephan
Hi,
try with attached file...-

Load this file into Workspace and then type:
>> SVMModel = fitcecoc(tsetALLstd, 'VarName5')
SVMModel =
ClassificationECOC
PredictorNames: {'VarName1' 'VarName2' 'VarName3' 'VarName4'}
ResponseName: 'VarName5'
CategoricalPredictors: []
ClassNames: [0.0 1.0 2.0 3.0]
ScoreTransform: 'none'
BinaryLearners: {6×1 cell}
CodingName: 'onevsone'
Properties, Methods
>> CV = crossval(SVMModel)
CV =
classreg.learning.partition.ClassificationPartitionedECOC
CrossValidatedModel: 'ECOC'
PredictorNames: {'VarName1' 'VarName2' 'VarName3' 'VarName4'}
ResponseName: 'VarName5'
NumObservations: 40
KFold: 10
Partition: [1×1 cvpartition]
ClassNames: [0.0 1.0 2.0 3.0]
ScoreTransform: 'none'
Properties, Methods
>> Model_loss = kfoldLoss(CV)
Model_loss =
0
Best regards
Stephan
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel and Cloud 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

