How to use loss() function in SVM trained model
Show older comments
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?

Answers (1)
Hi
here you find an example with step by step how to for your problem:
Best regards
Stephan
5 Comments
Asanka Dewappriya
on 5 May 2018
Stephan
on 5 May 2018
In your case the name of the 5th column
Asanka Dewappriya
on 5 May 2018
Stephan
on 6 May 2018
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
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
