From 99669c716b23c2d4fb8d632315584d3f0fb0ff7d Mon Sep 17 00:00:00 2001 From: Holden Karau Date: Thu, 5 May 2016 12:54:47 -0700 Subject: [PATCH] Add toDebugString to DecisionTreeModel --- python/pyspark/ml/classification.py | 2 ++ python/pyspark/ml/regression.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index f032963334469..4f520a9f0c20b 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -510,6 +510,8 @@ class DecisionTreeClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPred 1 >>> model.featureImportances SparseVector(1, {0: 1.0}) + >>> print(model.toDebugString) + DecisionTreeClassificationModel (uid=...) of depth 1 with 3 nodes... >>> test0 = sqlContext.createDataFrame([(Vectors.dense(-1.0),)], ["features"]) >>> result = model.transform(test0).head() >>> result.prediction diff --git a/python/pyspark/ml/regression.py b/python/pyspark/ml/regression.py index 04f566dfecd60..8e6f53eba3498 100644 --- a/python/pyspark/ml/regression.py +++ b/python/pyspark/ml/regression.py @@ -726,6 +726,12 @@ def depth(self): """Return depth of the decision tree.""" return self._call_java("depth") + @property + @since("2.0.0") + def toDebugString(self): + """Full description of model.""" + return self._call_java("toDebugString") + def __repr__(self): return self._call_java("toString")