关于在 Weka 中调查样本的初学者问题

发布于 2024-09-24 02:52:18 字数 113 浏览 0 评论 0原文

我刚刚使用 Weka 在“Classify”标签下训练我的 SVM 分类器。 现在我想进一步调查哪些数据样本被错误分类,我需要研究它们的模式,但我不知道从Weka哪里看这个。 有人可以给我一些帮助吗? 提前致谢。

I've just used Weka to train my SVM classifier under "Classify" tag.
Now I want to further investigate which data samples are mis-classified,I need to study their pattern,but I don't know where to look at this from Weka.
Could anyone give me some help please?
Thanks in advance.

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

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

发布评论

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

评论(1

虐人心 2024-10-01 02:52:18

您可以从以下位置启用该选项:

alt text

您将获得以下实例预测:

=== Predictions on test split ===

 inst#     actual   predicted  error prediction
   1   2:Iris-ver  2:Iris-ver         0.667 
  ...
  16   3:Iris-vir  2:Iris-ver   +     0.667 

编辑

As我在评论中解释过,您可以使用 StratifiedRemoveFolds 过滤器手动分割数据并创建 10 倍的交叉验证。

Weka wiki 中的这个 Primer 有一些如何从命令行调用 Weka 的示例。这是一个示例 bash 脚本:

#!/bin/bash

# I assume weka.jar is on the CLASSPATH

# 10-folds CV
for f in $(seq 1 10); do
    echo -n "."

    # create train/test set for fold=f
    java weka.filters.supervised.instance.StratifiedRemoveFolds -i iris.arff \
        -o iris-f$f-train.arff -c last -N 10 -F $f -V
    java weka.filters.supervised.instance.StratifiedRemoveFolds -i iris.arff \
        -o iris-f$f-test.arff -c last -N 10 -F $f

    # classify using SVM and store predictions of test set
    java weka.classifiers.functions.SMO -C 1.0 \
        -K "weka.classifiers.functions.supportVector.RBFKernel -G 0.01" \
        -t iris-f$f-train.arff -T iris-f$f-test.arff \
        -p 0 > f$f-pred.txt
        #-i > f$f-perf.txt
done
echo

对于每个折叠,这将创建两个数据集(训练/测试)并将预测存储在文本文件中。这样您就可以将每个索引与测试集中的实际实例进行匹配。

当然,如果您愿意的话,也可以在 GUI 中完成同样的操作(只是有点乏味!)

You can enable the option from:

alt text

You will get the following instance predictions:

=== Predictions on test split ===

 inst#     actual   predicted  error prediction
   1   2:Iris-ver  2:Iris-ver         0.667 
  ...
  16   3:Iris-vir  2:Iris-ver   +     0.667 

EDIT

As I explained in the comments, you can use the StratifiedRemoveFolds filter to manually split the data and create the 10-folds of the cross-validation.

This Primer from the Weka wiki has some examples of how to invoke Weka from the command line. Here's a sample bash script:

#!/bin/bash

# I assume weka.jar is on the CLASSPATH

# 10-folds CV
for f in $(seq 1 10); do
    echo -n "."

    # create train/test set for fold=f
    java weka.filters.supervised.instance.StratifiedRemoveFolds -i iris.arff \
        -o iris-f$f-train.arff -c last -N 10 -F $f -V
    java weka.filters.supervised.instance.StratifiedRemoveFolds -i iris.arff \
        -o iris-f$f-test.arff -c last -N 10 -F $f

    # classify using SVM and store predictions of test set
    java weka.classifiers.functions.SMO -C 1.0 \
        -K "weka.classifiers.functions.supportVector.RBFKernel -G 0.01" \
        -t iris-f$f-train.arff -T iris-f$f-test.arff \
        -p 0 > f$f-pred.txt
        #-i > f$f-perf.txt
done
echo

For each fold, this will create two datasets (train/test) and store the predictions in a text file as well. That way you can match each index with the actual instance in the test set.

Of course the same can be done in the GUI if you prefer (only a bit more tedious!)

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