CostMatrix

toc

= Format = Format of the cost matrices: code format="text" % Rows	Columns 2	2 % Matrix elements 0.0	5.0 1.0	0.0 code code format="text" [0.0 5.0; 1.0 0.0] code
 * regular
 * [|Matlab] single-line format (see also the [|Matlab Primer])

= Testing the format = The following code loads a cost matrix and prints its content to the console. Useful, if one wants to test whether the format is correct: code format="java" import weka.classifiers.CostMatrix; import java.io.BufferedReader; import java.io.FileReader; /** * Loads the cost matrix "args[0]" and prints its content to the console. * * @author FracPete (fracpete at waikato dot ac dot nz) */ public class CostMatrixLoader { public static void main(String[] args) throws Exception { CostMatrix matrix = new **CostMatrix**(                          new BufferedReader(new FileReader(args[0]))); System.out.println(matrix); } } code

= See also =
 * CostSensitiveClassifier
 * MetaCost

= Downloads =
 * [[file:CostMatrixLoader.java]] ([|book], [|stable-3.6], [|developer])