- Home
- Assessment

24 / 38

Train the Decision Tree Model on the 'Training' data set using cross-validation and calculate 'mean absolute error' and 'root mean squared error' (RMSE) for this model.

Display these scores using `display_scores()`

function.

Create a DecisionTreeRegressor instance, called

`dec_reg`

by passing random seed of 42 to the DecisionTreeRegressor.Call

`cross_val_score()`

function, to perform training and cross validation and to calculate the mean absolute error scores, by passing to it the following:`DecisionTreeRegressor object dec_reg trainingCols dataframe trainingLabels dataframe parameter cv with value 10 (cv=10) scoring parameter with value "neg_mean_absolute_error" dt_mae_scores = -cross_val_score(<<your code comes here>>) display_scores(dt_mae_scores)`

Call

`cross_val_score()`

function, to perform training and cross validation and to calculate the mean squared error scores, by passing to it the following:`DecisionTreeRegressor object dec_reg trainingCols dataframe trainingLabels dataframe parameter cv with value 10 (cv=10) scoring parameter with value "neg_mean_squared_error" dt_mse_scores = np.sqrt(-cross_val_score(<<your code comes here>>)) display_scores(dt_mse_scores)`

XP

Taking you to the next exercise in seconds...

Want to create exercises like this yourself? Click here.

Checking Please wait.

Success

Error

Fetching hint, please wait...

Error

Answer is not availble for this assesment

**Note - **Having trouble with the assessment engine? Follow the steps listed
here

## Loading comments...