How to change target class when using CLASSPERF

Dear all,
I wonder, How to specify a particular label as the target class when using CLASSPERF. For example, I want to indicate that Label 1 and 0 for Classout (classifier output) as Positive and Negative for disease, respectively. This is because, I follow the convention where, for classifier output, label equal to 1 as positive for disease. However, I notice, Matlab treat 0 as positive for output. From link, it seem we change the default by adjusting TargetClasses. However, I dont know how to exactly do it.
truelabels=[1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0];
classout= [1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 NaN];
CP = classperf(truelabels, classout);

 Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Oct. de 2017
scats = {'Negative', 'Positive'};
struelabels = scats(truelabels + 1);
sclassout = scats((classout==1) + 1);
sclassout(isnan(classout)) = {'Undefined'};
CP = classperf(struelabels, sclassout);
There might be a better way.

1 comentario

balandong
balandong el 11 de Oct. de 2017
Hi Walter, As usual, your suggestion always amaze me,very neat. Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Genomics and Next Generation Sequencing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Oct. de 2017

Comentada:

el 11 de Oct. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by