Skip to content

Commit 706d332

Browse files
committed
updated python DT runner to print full model if it is small
1 parent c76c823 commit 706d332

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/src/main/python/mllib/decision_tree_runner.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ def usage():
134134
categoricalFeaturesInfo=categoricalFeaturesInfo)
135135
# Print learned tree and stats.
136136
print "Trained DecisionTree for classification:"
137-
print " Model numNodes: %d\n" % model.numNodes()
138-
print " Model depth: %d\n" % model.depth()
139-
print " Training accuracy: %g\n" % getAccuracy(model, reindexedData)
140-
print model
137+
print " Model numNodes: %d" % model.numNodes()
138+
print " Model depth: %d" % model.depth()
139+
print " Training accuracy: %g" % getAccuracy(model, reindexedData)
140+
if model.numNodes() < 20:
141+
print model.toDebugString()
142+
else:
143+
print model
141144

142145
sc.stop()

0 commit comments

Comments
 (0)