相当于 ml.DecisionTreeClassificationModel 中的 mllib.DecisionTreeModel.toDebugString()

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

正如问题所说,在org.apache.spark.ml.classification.DecisionTreeClassificationModel

中是否有任何等同于Spark org.apache.spark.mllib.tree.model.DecisionTreeClassificationModel.toDebugString()的东西

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

感谢期待。

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

示例:

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