开发者

How to evaluate this scheme in RWeka?

开发者 https://www.devze.com 2023-01-29 11:23 出处:网络
The scheme I am trying to evaluate is: weka.classifiers.meta.AttributeSelectedClassifier -E \"weka.attributeSelection.CfsSubsetEval \" -S \"weka.attributeSelection.BestFirst -D 1 -N 5\" -W weka.class

The scheme I am trying to evaluate is:

weka.classifiers.meta.AttributeSelectedClassifier -E "weka.attributeSelection.CfsSubsetEval " -S "weka.attributeSelection.BestFirst -D 1 -N 5" -W weka.classifiers.functions.SMOreg -- -C 1.0 -N 0 -I "weka.classifiers.functions.supportVector.RegSMOImproved -L 0.0010 -W 1 -P 1.0E-12 -T 0.0010 -V" -K "weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0"

i.e. I am trying to run an AttributeSelectedClassifier with an SMOreg classifier inside. Every other parameter is the default value of the respective classifier.

So the R code is:

optns <- Weka_control(W = "weka.classifiers.functions.SMOreg")   
ASC <- make_Weka_classifier("weka/classifiers/meta/AttributeSelectedClassifier")  
model <- ASC(class ~ ., data = as.data.frame(dat), control = optns)  
evaluation <- evaluate_Weka_classifier(model, numFolds = 10)  
evaluation

When I run the above R code I get this error:

Error in .jcall(evaluation, "D", x, ...) : java.lang.NullPointerException

The above error happens in RWeka's evaluate.R where it tries to call the WEKA methods: "pctCorrect", "pctIncorrect", "pctUnclassified", "kappa", "meanAbsoluteError","rootMeanSquaredError","relativeAbsoluteError","rootRelativeSquaredError"

I also tried manually specifying the default values using the Weka_control object like so:

optns <- Weka_control(E = "weka.attributeSelection.CfsSubsetEval ",  
                      S = list("weka.attributeSelection.BestFirst", D = 1,N = 5),  
                      W = list("weka.classifiers.functions.SMOreg", "--", 
                               C=1.0, N=0,   
                      I = list("weka.classifiers.functions.supportVector.RegSMOImproved",
                               L = 0.0010, W=1,P=1.0E-12,T=0.0010,V=TRUE),
                      K = list("weka.classifiers.functions.supportVector.PolyKernel",
                               C=250007, E=1.0)))  
ASC <- make_Weka_classifier("weka/classifiers/meta/AttributeSelectedClassifier") 开发者_StackOverflow 
model <- ASC(class ~ ., data = as.data.frame(dat), control = optns)  
evaluation <- evaluate_Weka_classifier(model, numFolds = 10)  
evaluation

and I get this error:

Error in .jcall(classifier, "V", "buildClassifier", instances) : java.lang.Exception: Can't find class called: weka.classifiers.functions.SMOreg -- -C 1 -N 0 -I weka.classifiers.functions.supportVector.RegSMOImproved -L 0.001 -W 1 -P 1e-12 -T 0.001 -V -K weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1


I tried your example but got a different error (where dat is my own data frame)

    Error in model.frame.default(formula = class ~ ., data = dat) : 
  object is not a matrix

Your error may be not directly related to syntax of calling this Weka function but some issues with path setup.

0

精彩评论

暂无评论...
验证码 换一张
取 消