0

我试图评估的方案是:

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

4

1 回答 1

0

我尝试了您的示例,但出现了不同的错误(其中 dat 是我自己的数据框)

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

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

于 2011-03-25T20:30:02.970 回答