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);

 채택된 답변

Walter Roberson
Walter Roberson 2017년 10월 11일

0 개 추천

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

balandong
balandong 2017년 10월 11일
Hi Walter, As usual, your suggestion always amaze me,very neat. Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

질문:

2017년 10월 11일

댓글:

2017년 10월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by