Format
Format#
Format of the cost matrices:
- 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:
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);
}
}