matlab中refcurve,利用matlab中自带的的perfcurve函数评价多分类

本帖最后由 翻腾的鱼 于 2014-10-7 10:39 编辑

使用的是32位matlab R2014a。利用SVM做多分类,想要利用perfcurve 函数画出roc图,计算AUC然后对分类结果进行评价。

问题代码如下:

model = svmtrain(train_wine_labels, train_wine, '-c 2 -g 1 -b 1');

[predict_label, accuracy,dec_value] = svmpredict(test_wine_labels, test_wine, model,'-b 1');

[X,Y] = perfcurve(test_wine_labels,dec_value,'2')

运行结果如下:

Accuracy = 72.7273% (8/11) (classification)

??? Error using ==> perfcurve>preparedata at 1216

Array of scores must be a vector.

Error in ==> perfcurve at 330

[scores,labels,weights,ncv] = preparedata(scores,labels,weights);

Error in ==> chapter12 at 89

[X,Y] = perfcurve(test_wine_labels,dec_value,'2')

train_wine 和test_wine里面放的是训练和测试的特征数据。train_wine_lablels 和 test_wine_labels 里面放的是分类后的类别标签,可取1,2 或3.

疑问:

1、dec_value里面的值是怎么计算得到的啊?它里面的额值是不是表示分到某个类别的可能性大小,但是为什么会有负数存在呢?

2、运行结果能算出accuracy, 但是perfcurve就是运行不出来。想知道是不是参数写的不对啊什么的。求大侠高见,这个问题困扰我好多天:'(

PS:数据样本

这个是test_wine(归一化之后)

1        1        1

0.0376344086021506        0.0578947368421053        0.0111111111111111

0.123655913978495        0.100000000000000        0.111111111111111

0.0860215053763441        0.110526315789474        0.0388888888888889

0.182795698924731        0.205263157894737        0.150000000000000

0.602150537634409        0.426315789473684        0.377777777777778

0.166666666666667        0.0473684210526316        0.0111111111111111

0.413978494623656        0.373684210526316        0.455555555555556

0.198924731182796        0.178947368421053        0.0444444444444445

0        0        0

0.774193548387097        0.710526315789474        0.538888888888889

这个是test_wine_label

3

2

1

1

2

2

1

2

1

1

3

train_wine 和train_wine_label的形式同上

你可能感兴趣的:(matlab中refcurve)