class_docstr: A cross-validation iterator to when a dataset has been loaded with the
  :meth:`load_from_folds <surprise.dataset.Dataset.load_from_folds>`
  method.
  
  See an example in the :ref:`User Guide <load_from_folds_example>`.
class_docstr_tok: ["A","cross-validation","iterator","to","when","a","dataset","has","been","loaded","with","the",":","meth",":","`","load_from_folds","<","surprise.dataset.Dataset.load_from_folds",">","`","method",".","See","an","example","in","the",":","ref",":","`","User","Guide","<","load_from_folds_example",">","`","."]
docstr: Generator function to iterate over trainsets and testsets.
  
  Args:
      data(:obj:`Dataset<surprise.dataset.Dataset>`): The data containing
          ratings that will be divided into trainsets and testsets.
  
  Yields:
      tuple of (trainset, testset)
docstr_tok: ["Generator","function","to","iterate","over","trainsets","and","testsets",".","Args",":","data","(",":","obj",":","`","Dataset","<","surprise.dataset.Dataset",">","`",")",":","The","data","containing","ratings","that","will","be","divided","into","trainsets","and","testsets",".","Yields",":","tuple","of","(","trainset",",","testset",")"]
code: def split(self, data):
      """Generator function to iterate over trainsets and testsets.
  
      Args:
          data(:obj:`Dataset<surprise.dataset.Dataset>`): The data containing
              ratings that will be divided into trainsets and testsets.
  
      Yields:
          tuple of (trainset, testset)
      """
  
      self.n_splits = len(data.folds_files)
      for train_file, test_file in data.folds_files:
          raw_trainset = data.read_ratings(train_file)
          raw_testset = data.read_ratings(test_file)
          trainset = data.construct_trainset(raw_trainset)
          testset = data.construct_testset(raw_testset)
  
          yield trainset, testset
  
imports: import numbers
  from collections import defaultdict
  from itertools import chain
  from math import ceil, floor
  import numpy
  from ..utils import get_rng
label_desc: Use image node_id 1 for calling the PredefinedKFold obj's underlying member method code with example usage: obj.split(data) without return types