Equivalent of mllib.DecisionTreeModel.toDebugString() in ml.DecisionTreeClassificationModel

爱⌒轻易说出口 提交于 2019-12-12 03:22:41

问题


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

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?

Thanks in anticipation.


回答1:


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

Example:

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


来源:https://stackoverflow.com/questions/37678365/equivalent-of-mllib-decisiontreemodel-todebugstring-in-ml-decisiontreeclassifi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!