PDA

View Full Version : Problems programming Weka



pensadoro
03-01-2009, 08:16 AM
Hi everybody, I'm makig a new meta-algorithm and I need to access to the class weka.gui.Explorer.ClassifierPanel.java because I need to know the values of the variables testMode (1 if crossValidation, 4 if supplied test set...), numFolds, percent...
The easy solution is to declare them as static variables, but it'd be better can access from my java class in weka.classifiers.meta, however I'm unable.
ClassifierPanel.java calls buildClassifier (a method overwritten in my algorithm) and I don't have any variable or way to access to the class is executing my method.
Does anybody know how can I do that?

Thanks a lot,
Kevin

Mark
03-01-2009, 05:14 PM
Hi Kevin,

This doesn't sound like a very Weka-friendly way of doing things. What if your classifier is run from the command line (Weka has a full-featured command line interface that existed well before the GUIs were written)? Why do you need to know what sort of testing mode is being used (percentage split, x-val etc.) in buildClassifier().

Cheers,
Mark.

pensadoro
03-02-2009, 11:33 AM
It could be, but I need to use the algorithm from the GUI. In buildClassifier() I need to evaluate the algorithm with the test mode chosen by the user (variable testMode in ClassifierPanel.java). So it could by any testing mode and I need to know which mode has chosen the user (I also need to know numFolds (in x-val), percent...).

Cheers

Mark
03-02-2009, 04:36 PM
OK, sounds like you're going to have to hack the code :-)

Cheers,
Mark.

pensadoro
03-03-2009, 10:50 AM
That sounds very bad...
It's only that I want to make a special metaalgorithm. Traditional algorithms are called from startClassifier() in ClassifierPanel.java, they build a tree or whatever and they classify instances with their both methods (distribForInstance and classifyInstance).
What I want to do is to build a tree, but the tree must be built with different data (optimized data) and to calculate the optimized data I need to build and evaluate several trees (and I've to do that from my metaalgorithm class, in the method builtClassifier).

Cheers,
Kevin

Mark
03-03-2009, 05:17 PM
I'm still having a hard time understanding why knowledge of the evaluation mode is needed by your classifier. You should be able to compute your modified training data in buildClassifier() just using the data that passed in. Any access to test sets/folds by build classifier is effectively cheating.

Cheers,
Mark.