Database Reference
In-Depth Information
Metrics without and with an intercept
The impact of parameter settings for the decision tree
Decision trees provide two main parameters: maximum tree depth and the maximum
number of bins. We will now perform the same evaluation of the effect of parameter set-
tings for the decision tree model. Our starting point is to create an evaluation function for
the model, similar to the one used for the linear regression earlier. This function is
provided here:
def evaluate_dt(train, test, maxDepth, maxBins):
model = DecisionTree.trainRegressor(train, {},
impurity='variance', maxDepth=maxDepth, maxBins=maxBins)
preds = model.predict(test.map(lambda p: p.features))
actual = test.map(lambda p: p.label)
tp = actual.zip(preds)
rmsle = np.sqrt(tp.map(lambda (t, p):
Search WWH ::




Custom Search