code: def test_gridsearchcv_best_estimator(u1_ml100k):
      """Ensure that the best estimator is the one giving the best score (by
      re-running it)"""
  
      param_grid = {
          "n_epochs": [5],
          "lr_all": [0.002, 0.005],
          "reg_all": [0.4, 0.6],
          "n_factors": [1],
          "init_std_dev": [0],
      }
      gs = GridSearchCV(
          SVD,
          param_grid,
          measures=["mae"],
          cv=PredefinedKFold(),
          joblib_verbose=100,
      )
      gs.fit(u1_ml100k)
      best_estimator = gs.best_estimator["mae"]
  
      # recompute MAE of best_estimator
      mae = cross_validate(
          best_estimator,
          u1_ml100k,
          measures=["MAE"],
          cv=PredefinedKFold(),
      )["test_mae"]
  
      assert mae == gs.best_score["mae"]
  
file_path: Surprise/tests/test_search.py
imports: import os
  import numpy
  import pytest
  from scipy.stats import randint, uniform
  from surprise import Dataset, Reader, SVD
  from surprise.model_selection import cross_validate, GridSearchCV, KFold, PredefinedKFold, RandomizedSearchCV
label_desc: Use image node_id 3 for calling a global function with example usage: test_gridsearchcv_best_estimator(u1_ml100k) without return types