class_docstr: K-Folds cross validation iterator:
  Provides train/test indexes to split data in train test sets
  
  Parameters
  ----------
  k: int
      number of folds
  shuffle : bool
      If true, then the index is shuffled before splitting into train and
      test indices.
  
  Notes
  -----
  All folds except for last fold have size trunc(n/k), the last fold has
  the remainder.
class_docstr_tok: ["K-Folds","cross","validation","iterator",":","Provides","train\/test","indexes","to","split","data","in","train","test","sets","Parameters","--","--","--","--","--","k",":","int","number","of","folds","shuffle",":","bool","If","true",",","then","the","index","is","shuffled","before","splitting","into","train","and","test","indices",".","Notes","--","--","-","All","folds","except","for","last","fold","have","size","trunc","(","n\/k",")",",","the","last","fold","has","the","remainder","."]
docstr: yield index split into train and test sets
          
docstr_tok: ["yield","index","split","into","train","and","test","sets"]
code: def split(self, X, y=None, label=None):
      """yield index split into train and test sets"""
      # TODO: X and y are redundant, we only need nobs
  
      nobs = X.shape[0]
      index = np.array(range(nobs))
  
      if self.shuffle:
          np.random.shuffle(index)
  
      folds = np.array_split(index, self.k_folds)
      for fold in folds:
          test_index = np.zeros(nobs, dtype=bool)
          test_index[fold] = True
          train_index = np.logical_not(test_index)
          yield train_index, test_index
  
file_path: statsmodels/statsmodels/gam/gam_cross_validation/cross_validators.py
imports: from abc import ABCMeta, abstractmethod
  from statsmodels.compat.python import with_metaclass
  import numpy
label_desc: Use image node_id 2 for calling the KFold obj's underlying member method code with example usage: obj.split(X, y, label) without return types