code: def test_randomizedsearchcv_same_splits():
      """Ensure that all parameter combinations are tested on the same splits (we
      check their RMSE scores are the same once averaged over the splits, which
      should be enough). We use as much parallelism as possible."""
  
      data_file = os.path.join(
          os.path.dirname(__file__), "./u1_ml100k_test"
      )
      data = Dataset.load_from_file(data_file, reader=Reader("ml-100k"))
      kf = KFold(3, shuffle=True, random_state=4)
  
      # all RMSE should be the same (as param combinations are the same)
      param_distributions = {
          "n_epochs": [5],
          "lr_all": uniform(0.2, 0),
          "reg_all": uniform(0.4, 0),
          "n_factors": [5],
          "random_state": [0],
      }
      rs = RandomizedSearchCV(
          SVD, param_distributions, measures=["RMSE"], cv=kf, n_jobs=1
      )
      rs.fit(data)
  
      rmse_scores = [m for m in rs.cv_results["mean_test_rmse"]]
      assert (
          len(set(rmse_scores)) == 1
      )  # assert rmse_scores are all equal
  
      # Note: actually, even when setting random_state=None in kf, the same folds
      # are used because we use product(param_comb, kf.split(...)). However, it's
      # needed to have the same folds when calling fit again:
      rs.fit(data)
      rmse_scores += [m for m in rs.cv_results["mean_test_rmse"]]
      assert len(set(rmse_scores)) == 1
  
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 10 for calling a global function with example usage: test_randomizedsearchcv_same_splits() without return types