|
How can I set the cost matrix |
|
|
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes.
From inside the program there is a method setCostMatrix() in the CostSensitiveClassifier, and a constructor in CostMatrix that can read cost matrix from a Reader.
A possible snippet of code to create CostSensitiveClassifier:
Classifier csrf = new CostSensitiveClassifier();
((CostSensitiveClassifier)csrf).setClassifier(new RandomForest());
CostMatrix cm = new CostMatrix(2);
cm.initialize();
cm.setElement(0,1,20);
((CostSensitiveClassifier)csrf).setCostMatrix(cm);
Source: Weka FAQ
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.