Leave-one-out with Classifica​tionDiscri​minant

3 visualizzazioni (ultimi 30 giorni)
Matt
Matt il 31 Mar 2014
Risposto: Ilya il 1 Apr 2014
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

Risposte (1)

Ilya
Ilya il 1 Apr 2014
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.

Community Treasure Hunt

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

Start Hunting!

Translated by