title: How to build a full trainset when loading data from predefined folds in Surprise?
body: <p>I am using <a href="https://github.com/NicolasHug/Surprise" rel="nofollow noreferrer">Surprise</a> to evaluate various recommender system algorithms. I would like to calculate predictions and prediction coverage on all possible user and item permutations. My data is loaded in from predefined splits.</p>
  <p>My strategy to calculate prediction coverage is to</p>
  <ol>
  <li>build a full trainset and fit</li>
  <li>get lists of all users and items</li>
  <li>iterate through the list and make predictions</li>
  <li>count exceptions where predictions are impossible to calculate prediction coverage.</li>
  </ol>
  <p>Trying to call <code>data.build_full_trainset())</code> yields the following error:</p>
  <pre><code>AttributeError: 'DatasetUserFolds' object has no attribute 'build_full_trainset'
  
  </code></pre>
  <p>Is there a way to build a full trainset when loading data from predefined folds?</p>
  <p>Alternatively, I will attempt to combine the data externally from Surprise into a dataframe and redo the process. Or are there better approaches?</p>
  <p>Thank you.</p>
  <pre><code># %% #https://surprise.readthedocs.io/en/stable/getting_started.html#basic-usage
  
  import random
  import pickle
  import numpy as np
  import pandas as pd
  
  # from survey.data_cleaning import long_ratings
  from surprise import NormalPredictor
  from surprise import Dataset
  from surprise import Reader
  from surprise.model_selection import cross_validate
  from surprise.model_selection import GridSearchCV
  # from surprise.model_selection import LeaveOneOut, KFold
  from surprise.model_selection import PredefinedKFold
  
  #set random seed for reproducibility
  my_seed = 0
  random.seed(my_seed)
  np.random.seed(my_seed)
  
  path = 'data/recommenders/'
  
  def load_splits():
      &quot;&quot;&quot;
      Loads splits from files load data from splits created by colab code and stored to files. used in surprise_recommenders.py
  
      returns splits as dataset
      &quot;&quot;&quot;
      # path to dataset folder
      files_dir = 'data/recommenders/splits/'
      # This time, we'll use the built-in reader.
      reader = Reader(line_format='user item rating', sep=' ', skip_lines=0, rating_scale=(1, 5))
  
      # folds_files is a list of tuples containing file paths:
      # [(u1.base, u1.test), (u2.base, u2.test), ... (u5.base, u5.test)]
      train_file = files_dir + 'u%d.base'
      test_file = files_dir + 'u%d.test'
      folds_files = [(train_file % i, test_file % i) for i in (1, 2, 3, 4, 5)]
  
      data = Dataset.load_from_folds(folds_files, reader=reader)
      return data
  
  data = load_splits()
  
  pkf = PredefinedKFold()
  
  algos = {
    'NormalPredictor': {'constructor': NormalPredictor,
                        'param_grid': {}
     }}
  
  key = &quot;stratified_5_fold&quot;
  cv_results={}
  print(f&quot;Performing {key} cross validation.&quot;)
  for algo_name, v in algos.items():
      print(&quot;Working on algorithm: &quot;, algo_name)
      gs = GridSearchCV(v['constructor'], v['param_grid'], measures=['rmse', 'mae'], cv=pkf)
  
      gs.fit(data)
      # best RMSE score
      print(gs.best_score['rmse'])
      
      # combination of parameters that gave the best RMSE score
      print(gs.best_params['rmse'])
  
      # Predict on full dataset
      # Use the weights that yields the best rmse:
      algo = gs.best_estimator['rmse']
      algo.fit(data.build_full_trainset())     #predefined folds breaks it.
  
  
      cv_results[algo_name] = pd.DataFrame.from_dict(gs.cv_results)
  </code></pre>