Le jeudi 09 février 2012 à 15:31 +0200, Kari Ruohonen a écrit : > 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. I've never tried it myself, but ?Weka_control says: One can use lists for options taking multiple arguments, see the documentation for ‘SMO’ for an example.
So maybe nb.model<-AS(class~.,data=ex, control=Weka_control( E="weka.attributeSelection.CfsSubsetEval", S=list("weka.attributeSelection.BestFirst, D=1), W=list("weka.classifiers.bayes.NaiveBayes", D=1))) Cheers ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.