[R] how to pass weka classifier options with a meta classifier in RWeka?

Kari Ruohonen karruo at utu.fi
Thu Feb 9 14:31:14 CET 2012


Hi,
I am trying to replicate a training of AttributeSelectedClassifier with
CFsSubsetEval, BestFirst and NaiveBayes that I have initially done with
Weka. Now, I am trying to use RWeka in R.

I have a problem of passing arguments to the CfsSubsetEval, BestFirst
and NaiveBayes. I have first created an interface for the classifier
with:

AS<-make_Weka_classifier("weka/classifiers/meta/AttributeSelectedClassifier")

And then I am trying to run the classifier with:

nb.model<-AS(class~.,data=ex,
         control=Weka_control(
           E="weka.attributeSelection.CfsSubsetEval",
           S="weka.attributeSelection.BestFirst -D 1",
           W="weka.classifiers.bayes.NaiveBayes -D"))

But now, I get an error saying:

Error in .jcall(classifier, "V", "buildClassifier", instances) : 
  java.lang.Exception: Can't find class called:
weka.classifiers.bayes.NaiveBayes -D

indicating that the way I am passing the argument "-D" to the NaiveBayes
is incorrect. I am uncertain from the RWeka documentation how the
passing mechanism of Weka_control is supposed to work with meta
classifiers. All help is greatly appreciated.

Many thanks, Kari



More information about the R-help mailing list