如何在RWeka评估这个方案?

时间:2010-12-07 12:17:06

标签: r weka

我想评估的方案是:

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"

即。我正在尝试运行带有SMOreg分类器的AttributeSelectedClassifier。每个其他参数都是相应分类器的默认值。

所以R代码是:

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

当我运行上面的R代码时,我收到此错误:

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

上述错误发生在RWeka的evaluate.R中,它尝试调用WEKA方法:"pctCorrect", "pctIncorrect", "pctUnclassified", "kappa", "meanAbsoluteError","rootMeanSquaredError","relativeAbsoluteError","rootRelativeSquaredError"

我也尝试使用Weka_control对象手动指定默认值,如下所示:

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")  
model <- ASC(class ~ ., data = as.data.frame(dat), control = optns)  
evaluation <- evaluate_Weka_classifier(model, numFolds = 10)  
evaluation

我收到此错误:

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

1 个答案:

答案 0 :(得分:0)

我尝试了你的例子,但得到了一个不同的错误(其中dat是我自己的数据框)

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

您的错误可能与调用此Weka函数的语法没有直接关系,但是路径设置存在一些问题。