Database Reference
In-Depth Information
print "Decision Tree predictions: " +
str(true_vs_predicted_dt.take(5))
print "Decision Tree depth: " + str(dt_model.depth())
print "Decision Tree number of nodes: " +
str(dt_model.numNodes())
This should output these predictions:
Decision Tree predictions: [(16.0, 54.913223140495866),
(40.0, 54.913223140495866), (32.0, 53.171052631578945),
(13.0, 14.284023668639053), (1.0, 14.284023668639053)]
Decision Tree depth: 5
Decision Tree number of nodes: 63
Note
This is not as bad as it sounds. While we do not cover it here, the Python code included
with this chapter's code bundle includes an example of using categoric-
alFeaturesInfo . It does not make a large difference to performance in this case.
From a quick glance at these predictions, it appears that the decision tree might do better,
as the linear model is quite a way off in its predictions. However, we will apply more
stringent evaluation methods to find out.
Search WWH ::




Custom Search