如何在RWeka中评估这个方案?

发布于 2024-10-06 06:56:47 字数 2394 浏览 1 评论 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 的评估中。R 尝试调用 WEKA 方法: "pctCorrect"、"pctIn Correct"、"pctUnclassified" , "kappa", "meanAbsoluteError","rootMeanSquaredError","re​​lativeAbsoluteError","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(分类器,“V”,“buildClassifier”,实例): java.lang.Exception:找不到名为的类: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

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")  
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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘦怹 2024-10-13 06:56:47

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

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

您的错误可能与调用此 Weka 函数的语法不直接相关,而是与路径设置有关。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文