政策资讯

Policy Information


ML之DT:构建一个二元DT(sk的DTR)来进行评分预测+Graphviz可视化

来源: 重庆市软件正版化服务中心    |    时间: 2022-09-19    |    浏览量: 62602    |   

ML之DT:构建一个二元DT(sk的DTR)来进行评分预测+Graphviz可视化

目录

Graphviz软件的下载

输出结果

Graphviz可视化

核心代码


Graphviz软件的下载

Graphviz:可视化工具Graphviz的简介、安装、使用方法、经典案例之详细攻略

输出结果

dot文件内容

  1. digraph Tree {
  2. node [shape=box] ;
  3. 1 [label="X[10] <= 10.525\nmse = 0.652\nsamples = 1599\nvalue = 5.636"] ;
  4. 2 [label="X[9] <= 0.575\nmse = 0.431\nsamples = 983\nvalue = 5.366"] ;
  5. 1 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
  6. 2 [label="X[1] <= 0.748\nmse = 0.328\nsamples = 391\nvalue = 5.151"] ;
  7. 1 -> 2 ;
  8. 3 [label="mse = 0.289\nsamples = 328\nvalue = 5.201"] ;
  9. 2 -> 3 ;
  10. 4 [label="mse = 0.448\nsamples = 63\nvalue = 4.889"] ;
  11. 2 -> 4 ;
  12. 5 [label="X[1] <= 0.405\nmse = 0.449\nsamples = 592\nvalue = 5.508"] ;
  13. 1 -> 5 ;
  14. 6 [label="mse = 0.486\nsamples = 144\nvalue = 5.833"] ;
  15. 5 -> 6 ;
  16. 7 [label="mse = 0.393\nsamples = 448\nvalue = 5.404"] ;
  17. 5 -> 7 ;
  18. 8 [label="X[9] <= 0.645\nmse = 0.702\nsamples = 616\nvalue = 6.067"] ;
  19. 0 -> 8 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
  20. 9 [label="X[1] <= 1.015\nmse = 0.705\nsamples = 272\nvalue = 5.728"] ;
  21. 8 -> 9 ;
  22. 10 [label="mse = 0.591\nsamples = 262\nvalue = 5.794"] ;
  23. 9 -> 10 ;
  24. 11 [label="mse = 0.6\nsamples = 10\nvalue = 4.0"] ;
  25. 9 -> 11 ;
  26. 12 [label="X[10] <= 11.55\nmse = 0.536\nsamples = 344\nvalue = 6.334"] ;
  27. 8 -> 12 ;
  28. 13 [label="mse = 0.495\nsamples = 206\nvalue = 6.121"] ;
  29. 12 -> 13 ;
  30. 14 [label="mse = 0.43\nsamples = 138\nvalue = 6.652"] ;
  31. 12 -> 14 ;
  32. }

Graphviz可视化

评分预测的决策树

核心代码

  1. with open("wineTree.dot", 'w') as f:
  2. f = tree.export_graphviz(wineTree, out_file=f)

评论

QQ咨询 扫一扫加入群聊,了解更多平台咨询
微信咨询 扫一扫加入群聊,了解更多平台咨询
意见反馈
立即提交
QQ咨询
微信咨询
意见反馈