[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wekalist
Subject:    [Wekalist] Problem setting explicit CostMatrix for MetaCost (Weka >= 3.7.7)
From:       Alex Speder <alex.speder () gmail ! com>
Date:       2013-01-29 17:37:22
Message-ID: CAFWy9itXY4FwvSgLgnDmrK=OXZcDBiEvqq=fu5Lz3OuhKQSTZA () mail ! gmail ! com
[Download RAW message or body]

To whom it may concern,

It appears the version of MetaClassifier (1.0.2) included in the
packaging system needs an updated Description.props due to a changed
return type of CostMatrix.parseMatlab(String matlab) from Matrix
(<=3.7.6) to CostMatrix (>=3.7.7).  Currently it is listed as
compatible with anything >= 3.7.1.  Repackaging the currently supplied
version against Weka >= 3.7.7 appears to fix the problem for more
recent Weka versions, although I have not thoroughly tested this

Interestingly, due to the way the PropertyPanel works, the offending
code is never actually invoked (MetaCosts's setOptions() function) if
using the GUI, so this problem appears to only effect users of the
command line and those invoking MetaCost programmatically.  Included
output from the failed invocations below.

Command line:
C:\weka-3-7-8>java -cp
weka.jar;wekafiles\packages\metaCost\metaCost.jar
weka.classifiers.meta.MetaCost -cost-matrix "[0.0 1.0 1.0; 1.0 0.0
1.0; 1.0 1.0 0.0]" -I 10 -P 100 -S 1 -W weka.classifiers.rules.ZeroR
-t C:\weka-3-7-8\contact-lenses.arff
Exception in thread "main" java.lang.NoSuchMethodError:
weka.classifiers.CostMatrix.parseMatlab(Ljava/lang/String;)Lweka/core/Matrix;
        at weka.classifiers.meta.MetaCost.setOptions(MetaCost.java:338)
        at weka.classifiers.evaluation.Evaluation.evaluateModel(Evaluation.java:1380)
        at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:649)
        at weka.classifiers.AbstractClassifier.runClassifier(AbstractClassifier.java:297)
        at weka.classifiers.meta.MetaCost.main(MetaCost.java:668)


Programmatic (fully qualified classes used for clarity):
public class Test {
	public static void main(String[] args) throws Exception {
		weka.core.WekaPackageManager.loadPackages(false, true);
		weka.classifiers.AbstractClassifier cls =
(weka.classifiers.AbstractClassifier)weka.core.Utils.forName(weka.classifiers.Classifier.class,
"weka.classifiers.meta.MetaCost", null);
		cls.setOptions(weka.core.Utils.splitOptions("-cost-matrix [0.0] -I
10 -P 100 -S 1 -W weka.classifiers.rules.ZeroR"));
	}
}

Exception in thread "main" java.lang.NoSuchMethodError:
weka.classifiers.CostMatrix.parseMatlab(Ljava/lang/String;)Lweka/core/Matrix;
	at weka.classifiers.meta.MetaCost.setOptions(MetaCost.java:338)
	at com.mimosa.Test.main(Test.java:5)

Thanks!
--
Alex Speder
alex.speder@gmail.com

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@list.scms.waikato.ac.nz
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic