【问题标题】:Why is Decision tree not working as expected in WEKA?为什么决策树在 WEKA 中没有按预期工作?
【发布时间】:2015-01-26 02:16:13
【问题描述】:

我正在关注一本书“机器学习:开发人员和技术专业人员的实践”,以使用 WEKA 创建决策树。尽管我遵循了与书中所示相同的过程,但我没有得到相同的决策树。我正在使用 C4.5 (J48) 算法。

数据(arff 文件)

@relation ladygaga

@attribute placement {end_rack, cd_spec, std_rack}
@attribute prominence numeric
@attribute pricing numeric
@attribute eye_level {TRUE, FALSE}
@attribute customer_purchase {yes, no}

@data
end_rack,85,85,FALSE,yes
end_rack,80,90,TRUE,yes
cd_spec,83,86,FALSE,no
std_rack,70,96,FALSE,no
std_rack,68,80,FALSE,no
std_rack,65,70,TRUE,yes
cd_spec,64,65,TRUE,yes
end_rack,72,95,FALSE,yes
end_rack,69,70,FALSE,no
std_rack,75,80,FALSE,no
end_rack,75,70,TRUE,no
cd_spec,72,90,TRUE,no
cd_spec,81,75,FALSE,yes
std_rack,71,91,TRUE,yes

预期输出

我的输出

我做错了什么?

【问题讨论】:

    标签: machine-learning weka decision-tree


    【解决方案1】:

    这是本书的问题(将答案保留在这里,以便帮助本书的其他读者)。

    Book 预计 end_rack 类别中只有一个否定案例(在作者的树形图中查找 (5,1))。在书中提供的数据中,甚至在书籍网站上,实际上有两个否定案例(5,2)。我删除了一个否定案例,得到了与本书相同的决策树。

    这是更正后的数据 arff 文件

    @relation ladygaga
    
    @attribute placement {end_rack, cd_spec, std_rack}
    @attribute prominence numeric
    @attribute pricing numeric
    @attribute eye_level {TRUE, FALSE}
    @attribute customer_purchase {yes, no}
    
    @data
    end_rack,85,85,FALSE,yes
    end_rack,80,90,TRUE,yes
    cd_spec,83,86,FALSE,no
    std_rack,70,96,FALSE,no
    std_rack,68,80,FALSE,no
    std_rack,65,70,TRUE,yes
    cd_spec,64,65,TRUE,yes
    end_rack,72,95,FALSE,yes
    end_rack,69,70,FALSE,yes
    std_rack,75,80,FALSE,no
    end_rack,75,70,TRUE,no
    cd_spec,72,90,TRUE,no
    cd_spec,81,75,FALSE,yes
    std_rack,71,91,TRUE,yes
    

    正确输出

    【讨论】:

    • 我认为跟随刚刚出版的书的第一版总是有风险的。
    猜你喜欢
    • 2014-08-04
    • 2021-01-03
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-06
    相关资源
    最近更新 更多