[R] About classifier in RWeka

Huihua Lu hlu3 at mix.wvu.edu
Thu Jun 4 05:30:31 CEST 2009


Hi everyone,

I have trouble to use RWeka, I tried: (w=weather dataset, all 
preditors are nominal)

> m<-J48(play~., data=w)
> e<-evaluate_Weka_classifier(m,cost = matrix(c(0,2,1,0), 
+ ncol = 2),numFolds = 10, complexity = TRUE,seed = 123, 
+ class = TRUE)
it gives me exactly what I want, but when I tried the same classifier 
on the other published data: (iris dataset has all numeric preditors)

> m<-J48(Species~., data=iris)
> e <- evaluate_Weka_classifier(m,
+ cost = matrix(c(0,2,1,0), ncol = 2),
+ numFolds = 10, complexity=TRUE, class=TRUE)
it threw me the error as below:

Error in .jnew("weka/classifiers/Evaluation", instances, costMatrix) : 
  Failed to create object of class `weka/classifiers/Evaluation'
In addition: Warning message:
In .jnew("weka/classifiers/Evaluation", instances, costMatrix) :
  NewObject
("weka/classifiers/Evaluation","(Lweka/core/Instances;Lweka/classifiers
/CostMatrix;)V",...) failed

I know there are something wrong in the function of 
evaluate_Weka_classifier, but I am stuck. Any one can help me out? 
Is it because the attributes of predictors?  then, how can I set up 
the parameters in evaluat_Weka_classifier function? Thanks very much!

lu




More information about the R-help mailing list