WEKA: Interpreting a Cost Matrix

How do we interpret the cost matrix in WEKA? If I have 2 classes for forecasting (class 0 and class 1) and you want to punish classfication of class 0 as another class (say, double fine), what exactly is the matrix format?

It:

0 10 20 0 

or that

  0 20 10 0 

The source of confusion is the following two links:

1) JavaDoc for Weka CostMatrix says:

The element at position i, j in the matrix is ​​the penalty for classifying an instance of class j as class i.

2) However, the answer in this post seems to indicate a different one.

http://weka.8497.n7.nabble.com/cost-matrix-td5821.html

Given the first cost matrix, the message reads: "Marking up an instance of class 0 carries a cost of 10. Sorting an instance of class 1 is twice as expensive.

Thanks.

+7
weka
source share
1 answer

I know that my answer comes very late, but it can help someone, like this:

To increase the cost of classifying an element of class 0 as class 1, the correct format is second.

Certificate:

The cost matrix I used:

  0 1.0 1000.0 0 

Kneading matrix (from cross validation):

  ab <-- classified as 565 20 | a = ignored 54 204 | b = not_ignored 

Cross Validation Result:

 ... Total Cost 54020 ... 

This is the cost of 54 * 10000 + 20 * 1 , which corresponds to the above confusion scheme.

+6
source share

All Articles