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

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


On Thu, 2012-02-09 at 14:52 +0100, Milan Bouchet-Valat wrote:
> Le jeudi 09 février 2012 à 15:31 +0200, Kari Ruohonen a écrit :
<snip>
> > 
> > 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

Hi and thanks for the suggestion. Unfortunately, it results in a similar
error:

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

regards, Kari



More information about the R-help mailing list