相当于 ml.DecisionTreeClassificationModel 中的 mllib.DecisionTreeModel.toDebugString() [英] Equivalent of mllib.DecisionTreeModel.toDebugString() in ml.DecisionTreeClassificationModel

查看:19
本文介绍了相当于 ml.DecisionTreeClassificationModel 中的 mllib.DecisionTreeModel.toDebugString()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如问题所说,org.apache.spark.ml 中是否有任何相当于 Spark org.apache.spark.mllib.tree.model.DecisionTreeClassificationModel.toDebugString() 的东西.分类.决策树分类模型

As the question says, is there any equivalent of Spark org.apache.spark.mllib.tree.model.DecisionTreeClassificationModel.toDebugString() in org.apache.spark.ml.classification.DecisionTreeClassificationModel

我已经浏览了后者的 API 文档,发现这个方法 rootNode() 返回一个 org.apache.spark.ml.tree.Node 对象这似乎是一个递归对象,那么我应该使用这个类来自己构建树结构吗?

I have gone through the API doc of the latter and found this method rootNode() which gives back a org.apache.spark.ml.tree.Node object which seems to be a recursive object, so should I use this class instead to build the tree structure myself?

期待中的感谢.

推荐答案

org.apache.spark.ml.classification.DecisionTreeClassificationModel 已经实现了 toDebugString() 方法,因为它具有 DecisionTreeModel 作为特征.

org.apache.spark.ml.classification.DecisionTreeClassificationModel already have a toDebugString() method implemented because it has DecisionTreeModel as a trait.

示例:

class org.apache.spark.ml.classification.DecisionTreeClassificationModel
DecisionTreeClassificationModel of depth 1 with 3 nodes
  If (feature 378 <= 71.0)
   Predict: 1.0
  Else (feature 378 > 71.0)
   Predict: 0.0

这篇关于相当于 ml.DecisionTreeClassificationModel 中的 mllib.DecisionTreeModel.toDebugString()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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