Leave-one-out with ClassificationDiscriminant
3 次查看(过去 30 天)
显示 更早的评论
I am trying to run LDA to classify responses into multiple classes, and I would like to use leave-one-out CV on the data. I understand that I can run something like the following:
cls = ClassificationDiscriminant.fit(X,y,'Leaveout','on');
However, I do not see where in cls it gives any metrics, such as classification error or accuracy. Am I missing something when I look at cls?
Alternatively, I have tried the following:
cls = ClassificationDiscriminant.fit(X,labels');
cvmodel = crossval(cls,'Leaveout','on');
But it is also unclear where any useful metrics are stored in cvmodel. Am I supposed to use the predict function on cvmodel? If so, I'm getting an error because it is trying to use the predict.m function that's part of the ident toolbox. How can I tell it to use the one that's part of CompactCassificationDiscriminant?
Thanks
0 个评论
回答(1 个)
Ilya
2014-4-1
You could start by looking at the doc for ClassificationDiscriminant.fit and noticing the 2nd paragraph under Description:
obj = ClassificationDiscriminant.fit(x,y,Name,Value) fits a classifier with additional options specified by one or more Name,Value pair arguments. If you use one of the following five options, obj is of class ClassificationPartitionedModel: 'CrossVal', 'KFold', 'Holdout', 'Leaveout', or 'CVPartition'. Otherwise, obj is of class ClassificationDiscriminant.
Then you could click on the link for ClassificationPartitionedModel to read about its properties and methods.
Alternatively, you could type
methods(cls)
properties(cls)
and take it from there.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!