title: ValueError: 'mean_squared_error' is not a valid scoring value
body: <p>So, I have been working on my first ML project and as part of that I have been trying out various models from sci-kit learn and I wrote this piece of code for a random forest model:</p>
  <pre><code>#Random Forest
  reg = RandomForestRegressor(random_state=0, criterion = 'mse')
  #Apply grid search for best parameters
  params = {'randomforestregressor__n_estimators' : range(100, 500, 200),
            'randomforestregressor__min_samples_split' : range(2, 10, 3)}
  pipe = make_pipeline(reg)
  grid = GridSearchCV(pipe, param_grid = params, scoring='mean_squared_error', n_jobs=-1, iid=False, cv=5)
  reg = grid.fit(X_train, y_train)
  print('Best MSE: ', grid.best_score_)
  print('Best Parameters: ', grid.best_estimator_)
  
  y_train_pred = reg.predict(X_train)
  y_test_pred = reg.predict(X_test)
  tr_err = mean_squared_error(y_train_pred, y_train)
  ts_err = mean_squared_error(y_test_pred, y_test)
  print(tr_err, ts_err)
  results_train['random_forest'] = tr_err
  results_test['random_forest'] = ts_err
  
  </code></pre>
  <p>But, when I run this code, I get the following error:</p>
  <pre><code>KeyError                                  Traceback (most recent call last)
  ~\anaconda3\lib\site-packages\sklearn\metrics\_scorer.py in get_scorer(scoring)
      359             else:
  --&gt; 360                 scorer = SCORERS[scoring]
      361         except KeyError:
  
  KeyError: 'mean_squared_error'
  
  During handling of the above exception, another exception occurred:
  
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-149-394cd9e0c273&gt; in &lt;module&gt;
        5 pipe = make_pipeline(reg)
        6 grid = GridSearchCV(pipe, param_grid = params, scoring='mean_squared_error', n_jobs=-1, iid=False, cv=5)
  ----&gt; 7 reg = grid.fit(X_train, y_train)
        8 print('Best MSE: ', grid.best_score_)
        9 print('Best Parameters: ', grid.best_estimator_)
  
  ~\anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
       71                           FutureWarning)
       72         kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
  ---&gt; 73         return f(**kwargs)
       74     return inner_f
       75 
  
  ~\anaconda3\lib\site-packages\sklearn\model_selection\_search.py in fit(self, X, y, groups, **fit_params)
      652         cv = check_cv(self.cv, y, classifier=is_classifier(estimator))
      653 
  --&gt; 654         scorers, self.multimetric_ = _check_multimetric_scoring(
      655             self.estimator, scoring=self.scoring)
      656 
  
  ~\anaconda3\lib\site-packages\sklearn\metrics\_scorer.py in _check_multimetric_scoring(estimator, scoring)
      473     if callable(scoring) or scoring is None or isinstance(scoring,
      474                                                           str):
  --&gt; 475         scorers = {&quot;score&quot;: check_scoring(estimator, scoring=scoring)}
      476         return scorers, False
      477     else:
  
  ~\anaconda3\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
       71                           FutureWarning)
       72         kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
  ---&gt; 73         return f(**kwargs)
       74     return inner_f
       75 
  
  ~\anaconda3\lib\site-packages\sklearn\metrics\_scorer.py in check_scoring(estimator, scoring, allow_none)
      403                         &quot;'fit' method, %r was passed&quot; % estimator)
      404     if isinstance(scoring, str):
  --&gt; 405         return get_scorer(scoring)
      406     elif callable(scoring):
      407         # Heuristic to ensure user has not passed a metric
  
  ~\anaconda3\lib\site-packages\sklearn\metrics\_scorer.py in get_scorer(scoring)
      360                 scorer = SCORERS[scoring]
      361         except KeyError:
  --&gt; 362             raise ValueError('%r is not a valid scoring value. '
      363                              'Use sorted(sklearn.metrics.SCORERS.keys()) '
      364                              'to get valid options.' % scoring)
  
  ValueError: 'mean_squared_error' is not a valid scoring value. Use sorted(sklearn.metrics.SCORERS.keys()) to get valid options.
  
  </code></pre>
  <p>So, I tried running it by removing the <code>scoring='mean_squared_error'</code> from <code>GridSearchCV(pipe, param_grid = params, scoring='mean_squared_error', n_jobs=-1, iid=False, cv=5)</code>. When I do that, the code runs perfectly and gives a decent enough training and testing error.</p>
  <p>Regardless of that, I can't figure out why with <code>scoring='mean_squared_error'</code> parameter in <code>GridSearchCV</code> function throws me that error. What am I doing wrong?</p>