【问题标题】:Prediction in weka using explorer使用资源管理器在 weka 中进行预测
【发布时间】:2015-06-17 05:08:07
【问题描述】:

一旦我训练并生成了一个模型,到目前为止,从我所看到的示例来看,我们正在使用一个测试集,我们必须在其中输入实际值和预测值,有没有一种方法可以让我把这个实际值在进行预测时,列为空或根本无法使用它

如果我举个例子,下面是我的训练集

@relation supermarket
@attribute 'department1' { t}
@attribute 'department2' { t}
@attribute 'department3' { t}
@attribute value

并且正在使用类似的测试集

 @relation supermarket
@attribute 'department1' { t}
@attribute 'department2' { t}
@attribute 'department3' { t}
@attribute value

和输出类似

@relation supermarket
@attribute 'department1' { t}
@attribute 'department2' { t}
@attribute 'department3' { t}
@attribute value
@attribute predicted-value
@attribute predicted-margin

我的问题是我可以从测试集中删除值还是将其保留为空

【问题讨论】:

    标签: weka


    【解决方案1】:

    案例 1:您的训练集和测试集都有类标签

    培训:

    @relation
    simple-training
    @attribute
    feature1 numeric
    feature2 numeric
    class string{a,b}
    @data
    1, 2, b
    2, 4, a
    .......
    

    测试:

    @relation
    simple-testing
    @attribute
    feature1 numeric
    feature2 numeric
    class string{a,b}
    @data
    7, 12, a
    8, 14, a
    .......
    

    在这种情况下,无论您使用的是 k-fold cv 还是 train-test 设置,Weka 都不会查看您在测试集中的类标签。它从训练中获取模型,盲目地将其应用于测试集,然后将其预测与测试集中的实际类标签进行比较。

    如果您想查看分类器的性能评估,这很有用。

    案例 2:您有训练数据的类标签,但没有测试数据的类标签。

    培训:

    @relation
        simple-training
        @attribute
        feature1 numeric
        feature2 numeric
        class string{a,b}
        @data
        1, 2, b
        2, 4, a
        .......
    

    测试:

     @relation
        simple-testing
        @attribute
        feature1 numeric
        feature2 numeric
        class string{a,b}
        @data
        7, 12, ?
        8, 14, ?
        .......
    

    这是非常正常的,因为这是我们需要做的——将训练模型应用于看不见的未标记数据来标记它们!在这种情况下,只需将? 标记放在您的测试类标签上。在此设置上运行 Weka 后,您将获得由预测值替换的这些 ? 标记的输出(您不需要创建任何额外的列,因为这会给您带来错误)。

    因此,简而言之,您需要在训练和测试数据中保持兼容性。在测试数据中,如果您不知道该值并想对其进行预测,请在该列中添加? 标记。

    【讨论】:

    • 嗨@Rushidi shams,我试过这个,但它没有产生输出code@relation simple-training @attribute feature1 numeric @attribute feature2 numeric @attribute class{a,b} @ data 1, 2, b 2, 4, a code 和这样的测试集 code @relation simple-testing @attribute feature1 numeric @attribute feature2 numeric @attribute class {a,b} @data 7, 12, ? 8, 14, ? code 算法运行但检索到我的输入 code === 摘要 === 实例总数 0 忽略的类未知实例 2 === 按类的详细准确度 === code
    • 你先训练了吗,保存模型并应用到测试集上?
    • 是的,我已经尝试过与给出输出相同的方法,但是当我得到 Ignored Class Unknown Instances 4 时我很困惑,因为我给出的类变量是正确的?
    • 好的。请编辑问题并在此处发布您当前的培训和测试文件内容
    猜你喜欢
    • 1970-01-01
    • 2013-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-15
    • 2020-05-13
    相关资源
    最近更新 更多