フィルターのクリア

How to change target class when using CLASSPERF

2 ビュー (過去 30 日間)
balandong
balandong 2017 年 10 月 11 日
コメント済み: balandong 2017 年 10 月 11 日
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 日
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 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by