Login using Social Account
     Continue with GoogleLogin using your credentials
Models to be trained and analyzed:
DecisionTreeRegressor
LinearRegression
RandomForestRegressor
Metrics calculated: neg_mean_absolute_error, neg_mean_squared_error using cross-validation
Task 1: Complete the statement to define forest_reg as a RandomForestRegressor with random_state = 42
Task 2: Store predicted values from the classifier using cross_val_predict. As identified as action tasks Consider 'xformHr', 'temp', 'dayCount' as the training features and 10 folds.
# Task 1: make changes here
forest_reg = RandomForestRegressor(max_depth=32, min_samples_split = 128, min_samples_leaf= 10, random_state=42)
# Task 2: Is everything ok here?
display_scores(-cross_val_score(forest_reg, train_set[['xformWorkHr','temp','dayCount']], train_set['cntDeTrended'], cv=10, scoring="neg_mean_absolute_error"))
display_scores(np.sqrt(-cross_val_score(forest_reg, train_set[['xformWorkHr','temp','dayCount']], train_set['cntDeTrended'], cv=10, scoring="neg_mean_squared_error")))
train_set_freg = train_set.copy()
train_set_freg['predictedCounts'] = cross_val_predict(forest_reg, train_set[['xformWorkHr','temp','dayCount']], train_set['cntDeTrended'], cv=10)
train_set_freg['resids'] = train_set_freg['predictedCounts'] - train_set_freg['cntDeTrended']
Features used:
xformWorkHr
temp
dayCount
Note:
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...