class_docstr: Multilabel stratified K-Folds cross-validator
  Provides train/test indices to split multilabel data into train/test sets.
  This cross-validation object is a variation of KFold that returns
  stratified folds for multilabel data. The folds are made by preserving
  the percentage of samples for each label.
  Parameters
  ----------
  n_splits : int, default=3
      Number of folds. Must be at least 2.
  shuffle : boolean, optional
      Whether to shuffle each stratification of the data before splitting
      into batches.
  random_state : int, RandomState instance or None, optional, default=None
      If int, random_state is the seed used by the random number generator;
      If RandomState instance, random_state is the random number generator;
      If None, the random number generator is the RandomState instance used
      by `np.random`. Unlike StratifiedKFold that only uses random_state
      when ``shuffle`` == True, this multilabel implementation
      always uses the random_state since the iterative stratification
      algorithm breaks ties randomly.
  Examples
  --------
  >>> from iterstrat.ml_stratifiers import MultilabelStratifiedKFold
  >>> import numpy as np
  >>> X = np.array([[1,2], [3,4], [1,2], [3,4], [1,2], [3,4], [1,2], [3,4]])
  >>> y = np.array([[0,0], [0,0], [0,1], [0,1], [1,1], [1,1], [1,0], [1,0]])
  >>> mskf = MultilabelStratifiedKFold(n_splits=2, random_state=0)
  >>> mskf.get_n_splits(X, y)
  2
  >>> print(mskf)  # doctest: +NORMALIZE_WHITESPACE
  MultilabelStratifiedKFold(n_splits=2, random_state=0, shuffle=False)
  >>> for train_index, test_index in mskf.split(X, y):
  ...    print("TRAIN:", train_index, "TEST:", test_index)
  ...    X_train, X_test = X[train_index], X[test_index]
  ...    y_train, y_test = y[train_index], y[test_index]
  TRAIN: [0 3 4 6] TEST: [1 2 5 7]
  TRAIN: [1 2 5 7] TEST: [0 3 4 6]
  Notes
  -----
  Train and test sizes may be slightly different in each fold.
  See also
  --------
  RepeatedMultilabelStratifiedKFold: Repeats Multilabel Stratified K-Fold
  n times.
class_docstr_tok: ["Multilabel","stratified","K-Folds","cross-validator","Provides","train\/test","indices","to","split","multilabel","data","into","train\/test","sets",".","This","cross-validation","object","is","a","variation","of","KFold","that","returns","stratified","folds","for","multilabel","data",".","The","folds","are","made","by","preserving","the","percentage","of","samples","for","each","label",".","Parameters","--","--","--","--","--","n_splits",":","int",",","default=3","Number","of","folds",".","Must","be","at","least","2.","shuffle",":","boolean",",","optional","Whether","to","shuffle","each","stratification","of","the","data","before","splitting","into","batches",".","random_state",":","int",",","RandomState","instance","or","None",",","optional",",","default=None","If","int",",","random_state","is","the","seed","used","by","the","random","number","generator",";","If","RandomState","instance",",","random_state","is","the","random","number","generator",";","If","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","`","np.random","`",".","Unlike","StratifiedKFold","that","only","uses","random_state","when","``","shuffle","``","==","True",",","this","multilabel","implementation","always","uses","the","random_state","since","the","iterative","stratification","algorithm","breaks","ties","randomly",".","Examples","--","--","--","--",">",">",">","from","iterstrat.ml_stratifiers","import","MultilabelStratifiedKFold",">",">",">","import","numpy","as","np",">",">",">","X","=","np.array","(","[","[","1,2","]",",","[","3,4","]",",","[","1,2","]",",","[","3,4","]",",","[","1,2","]",",","[","3,4","]",",","[","1,2","]",",","[","3,4","]","]",")",">",">",">","y","=","np.array","(","[","[","0,0","]",",","[","0,0","]",",","[","0,1","]",",","[","0,1","]",",","[","1,1","]",",","[","1,1","]",",","[","1,0","]",",","[","1,0","]","]",")",">",">",">","mskf","=","MultilabelStratifiedKFold","(","n_splits=2",",","random_state=0",")",">",">",">","mskf.get_n_splits","(","X",",","y",")","2",">",">",">","print","(","mskf",")","#","doctest",":","+NORMALIZE_WHITESPACE","MultilabelStratifiedKFold","(","n_splits=2",",","random_state=0",",","shuffle=False",")",">",">",">","for","train_index",",","test_index","in","mskf.split","(","X",",","y",")",":","...","print","(","``","TRAIN",":","''",",","train_index",",","``","TEST",":","''",",","test_index",")","...","X_train",",","X_test","=","X","[","train_index","]",",","X","[","test_index","]","...","y_train",",","y_test","=","y","[","train_index","]",",","y","[","test_index","]","TRAIN",":","[","0","3","4","6","]","TEST",":","[","1","2","5","7","]","TRAIN",":","[","1","2","5","7","]","TEST",":","[","0","3","4","6","]","Notes","--","--","-","Train","and","test","sizes","may","be","slightly","different","in","each","fold",".","See","also","--","--","--","--","RepeatedMultilabelStratifiedKFold",":","Repeats","Multilabel","Stratified","K-Fold","n","times","."]
code: def _iter_test_masks(self, X=None, y=None, groups=None):
      test_folds = self._make_test_folds(X, y)
      for i in range(self.n_splits):
          yield test_folds == i
  
file_path: iterative-stratification/iterstrat/ml_stratifiers.py
imports: import numpy
  from sklearn.utils import check_random_state
  from sklearn.utils.validation import _num_samples, check_array
  from sklearn.utils.multiclass import type_of_target
  from sklearn.model_selection._split import _BaseKFold, _RepeatedSplits, BaseShuffleSplit, _validate_shuffle_split
label_desc: Use image node_id 3 for calling the MultilabelStratifiedKFold obj's underlying member method code with example usage: obj._iter_test_masks(X, y, groups) without return types