Weka - 找不到允许的类 [英] Weka - Can't find a permissible class

查看:26
本文介绍了Weka - 找不到允许的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 Weka 集成到我为另一个应用程序编写的插件中.我在我的类路径中包含了 weka.jar,并且在大多数情况下,事情似乎运行良好.不幸的是,当我要更改某些分类器的选项时,我遇到了无法找到某些类的特定问题.例如,当我尝试在 AdaBoost 选项中更改分类器的名称时,我收到一个以这样结尾的错误:

I'm integrating Weka into a plug-in I'm writing for another application. I included weka.jar in my class path and for the most part, things seem to be working well. Unfortunately, when I get to the point of changing the options for some classifiers, I run into problems specific to being unable to find certain classes. For example, when I try to change the name of the classifier in the AdaBoost options, I get an error that ends like so:

java.lang.Exception: Can't find a permissible class called: weka.classifiers.bayes.BayesNet
Model options set to: -P 50 -S 1 -I 10 -W weka.classifiers.bayes.BayesNet
    at weka.core.ResourceUtils.forName(ResourceUtils.java:84)
    at weka.core.Utils.forName(Utils.java:1080)
    at weka.classifiers.AbstractClassifier.forName(AbstractClassifier.java:91)
    at weka.classifiers.SingleClassifierEnhancer.setOptions(SingleClassifierEnhancer.java:108)
    at weka.classifiers.IteratedSingleClassifierEnhancer.setOptions(IteratedSingleClassifierEnhancer.java:115)
    at weka.classifiers.RandomizableIteratedSingleClassifierEnhancer.setOptions(RandomizableIteratedSingleClassifierEnhancer.java:93)
    at weka.classifiers.meta.AdaBoostM1.setOptions(AdaBoostM1.java:375)

我认为这可能与我在 OSGi 包中使用 JAR 有关,但我不确定.有任何想法吗?除了这个问题,我可以使用默认选项训练这些分类器.

I'm thinking that this might have something to do with me using the JAR in an OSGi bundle, but I'm not sure. Any ideas? Other than this issue, I'm able to train these classifiers just fine using the default options for them.

谢谢.

推荐答案

通过 setter 设置所有参数来解决这个问题.像这样使用时出现这个问题

Solve this problem via set all parameters via setters. This problem when you use like this

        BayesNet processes = new BayesNet();
        String options = "-D -Q weka.classifiers.bayes.net.search.local.K2 -- -P 1 -S BAYES -E weka.classifiers.bayes.net.estimate.SimpleEstimator -- -A 0.5";
        processes.setOptions(weka.core.Utils.splitOptions(options));

像这样更改设置所有参数.(这里不是所有选项,小例子)

Change set all param like this.(Here not all option, small example)

        BayesNet processes = new BayesNet();
        SimpleEstimator newBayesNetEstimator = new SimpleEstimator();
        newBayesNetEstimator.setAlpha(0.5);
        processes.setEstimator(newBayesNetEstimator);

这篇关于Weka - 找不到允许的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆