如何根据Weka提供的结果绘制DET曲线?

时间:2014-06-06 08:22:44

标签: matlab machine-learning weka

我遇到了4个类之间的分类问题,我用这个分类Weka,我得到了这种形式的结果:

Correctly Classified Instances        3860               96.5    %
Incorrectly Classified Instances       140                3.5    %
Kappa statistic                          0.9533
Mean absolute error                      0.0178
Root mean squared error                  0.1235
Relative absolute error                  4.7401 %
Root relative squared error             28.5106 %
Total Number of Instances             4000     

=== Detailed Accuracy By Class ===

               TP Rate   FP Rate   Precision   Recall  F-Measure   ROC Area  Class
                 0.98      0.022      0.936     0.98      0.957      0.998    A
                 0.92      0.009      0.973     0.92      0.946      0.997    B
                 0.991     0.006      0.982     0.991     0.987      1        C
                 0.969     0.01       0.971     0.969     0.97       0.998    D
Weighted Avg.    0.965     0.012      0.965     0.965     0.965      0.998

=== Confusion Matrix ===

   a   b   c   d   <-- classified as
 980  17   1   2 |   a = A
  61 920   1  18 |   b = B
   0   0 991   9 |   c = C
   6   9  16 969 |   d = D

我现在的目标是从Weka提供的结果中绘制(Detection Error Trade-off)DET曲线。

我找到了一个允许我绘制DET曲线的MATLAB代码,这里有一些代码行:

Ntrials_True = 1000;
   True_scores = randn(Ntrials_True,1);

   Ntrials_False = 1000;
      mean_False = -3;
      stdv_False = 1.5;
   False_scores = stdv_False * randn(Ntrials_False,1) + mean_False;

   %-----------------------
   % Compute Pmiss and Pfa from experimental detection output scores

   [P_miss,P_fa] = Compute_DET(True_scores,False_scores);

函数Compute_DET的代码是:

[Pmiss, Pfa] = Compute_DET(true_scores, false_scores)
num_true = max(size(true_scores));
num_false = max(size(false_scores));

total=num_true+num_false;

Pmiss = zeros(num_true+num_false+1, 1); %preallocate for speed
Pfa   = zeros(num_true+num_false+1, 1); %preallocate for speed

scores(1:num_false,1) = false_scores;
scores(1:num_false,2) = 0;
scores(num_false+1:total,1) = true_scores;
scores(num_false+1:total,2) = 1;

scores=DETsort(scores);

sumtrue=cumsum(scores(:,2),1);
sumfalse=num_false - ([1:total]'-sumtrue);

Pmiss(1) = 0;
Pfa(1) = 1.0;
Pmiss(2:total+1) = sumtrue  ./ num_true;
Pfa(2:total+1)   = sumfalse ./ num_false;

return

但是我对翻译不同参数的含义有疑问。例如mean_Falsestdv_False的重要性是什么?与Weka参数的对应关系是什么?

0 个答案:

没有答案