Bikes Assessment Project - ValueError: 'neg_mean_absoute_error' is not a valid scoring value

Hi,

For the bike assessment project I have been following all the details as per the suggestions but still I am unable to display the mae and rmse scores.

Please help fix this issue. Thanks!

Getting an error message as below:
__________________________________________-
ValueError: ‘neg_mean_absoute_error’ is not a valid scoring value. Use sorted(sklearn.metrics.SCORERS.keys()) to get valid options.


Code Snippet -
dec_reg = DecisionTreeRegressor(random_state = 42)

dt_mae_scores = -cross_val_score(dec_reg, trainingCols, trainingLabels,
scoring=“neg_mean_absoute_error”, cv=10)
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)



KeyError Traceback (most recent call last)
/usr/local/anaconda/lib/python3.6/site-packages/sklearn/metrics/_scorer.py in get_scorer(scoring)
358 else:
–> 359 scorer = SCORERS[scoring]
360 except KeyError:

KeyError: ‘neg_mean_absoute_error’

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
in
4
5 dt_mae_scores = -cross_val_score(dec_reg, trainingCols, trainingLabels,
----> 6 scoring=“neg_mean_absoute_error”, cv=10)
7 display_scores(dt_mae_scores)
8

/usr/local/anaconda/lib/python3.6/site-packages/sklearn/model_selection/_validation.py in cross_val_score(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch, error_score)
381 “”"
382 # To ensure multimetric format is not supported
–> 383 scorer = check_scoring(estimator, scoring=scoring)
384
385 cv_results = cross_validate(estimator=estimator, X=X, y=y, groups=groups,

/usr/local/anaconda/lib/python3.6/site-packages/sklearn/metrics/_scorer.py in check_scoring(estimator, scoring, allow_none)
401 “‘fit’ method, %r was passed” % estimator)
402 if isinstance(scoring, str):
–> 403 return get_scorer(scoring)
404 elif callable(scoring):
405 # Heuristic to ensure user has not passed a metric

/usr/local/anaconda/lib/python3.6/site-packages/sklearn/metrics/_scorer.py in get_scorer(scoring)
361 raise ValueError(’%r is not a valid scoring value. ’
362 'Use sorted(sklearn.metrics.SCORERS.keys()) ’
–> 363 ‘to get valid options.’ % scoring)
364 else:
365 scorer = scoring

ValueError: ‘neg_mean_absoute_error’ is not a valid scoring value. Use sorted(sklearn.metrics.SCORERS.keys()) to get valid options.

You can go through the below discussion and see if it helps: