code: def test_randomizedsearchcv_best_estimator(u1_ml100k):
      """Ensure that the best estimator is the one that gives the best score (by
      re-running it)"""
  
      param_distributions = {
          "n_epochs": [5],
          "lr_all": uniform(0.002, 0.003),
          "reg_all": uniform(0.04, 0.02),
          "n_factors": [1],
          "init_std_dev": [0],
      }
      rs = RandomizedSearchCV(
          SVD,
          param_distributions,
          measures=["mae"],
          cv=PredefinedKFold(),
          joblib_verbose=100,
      )
      rs.fit(u1_ml100k)
      best_estimator = rs.best_estimator["mae"]
  
      # recompute MAE of best_estimator
      mae = cross_validate(
          best_estimator,
          u1_ml100k,
          measures=["MAE"],
          cv=PredefinedKFold(),
      )["test_mae"]
  
      assert mae == rs.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 9 for calling a global function with example usage: test_randomizedsearchcv_best_estimator(u1_ml100k) without return types