Chapter 19 : End to End Project - Bikes Assessment - Basic - Train and Analyze the Models - Train DecisionTree Model


#1

from sklearn.metrics import mean_squared_error,mean_absolute_error

dec_reg=DecisionTreeRegressor(random_state=42)
dt_mae_scores = -cross_val_score(dec_reg, trainingCols, trainingLabels, cv=10,scoring=“neg_mean_absolute_error”)
display_scores(dt_mae_scores)

dt_mse_scores = np.sqrt(-cross_val_score(dec_reg, trainingCols, trainingLabels,
scoring=“neg_mean_squared_error”, cv=10))

display_scores(dt_mse_scores)

I am getting error " dec_reg not defined" But after execution in file i got below output

Scores: [42.79622021 50.31963846 37.03615448 44.15365653 47.07723911 72.03782895
58.36019737 48.22615132 50.94407895 96.88898026]
Mean: 54.78401456342171
Standard deviation: 16.70953413912157
Scores: [ 65.10279464 77.670527 60.59989749 73.66268699 75.76702279
113.26870416 96.665763 81.28550338 86.87354694 149.4085296 ]
Mean: 88.03049759858746
Standard deviation: 25.035783082114