class_docstr: Grouping data by user or item then splitting data into training, validation, and test sets.
  
  Parameters
  ----------
  data: array-like, required
      Raw preference data in the triplet format [(user_id, item_id, rating_value, timestamp)].
  
  group_by: str, optional, default: 'user'
      Grouping by 'user' or 'item'.
  
  chrono: bool, optional, default False
      Data is ordered by reviewed time or not. If this option is True, data must be in 'UIRT' format.
  
  test_size: float, optional, default: 0.2
      The proportion of the test set,         if > 1 then it is treated as the size of the test set.
  
  val_size: float, optional, default: 0.0
      The proportion of the validation set,         if > 1 then it is treated as the size of the validation set.
  
  rating_threshold: float, optional, default: 1.0
      Threshold used to binarize rating values into positive or negative feedback for
      model evaluation using ranking metrics (rating metrics are not affected).
  
  seed: int, optional, default: None
      Random seed for reproducibility.
  
  exclude_unknowns: bool, optional, default: True
      If `True`, unknown users and items will be ignored during model evaluation.
  
  verbose: bool, optional, default: False
      Output running log.
code: def __init__(
      self,
      data,
      group_by="user",
      chrono=False,
      fmt="UIRT",
      test_size=0.2,
      val_size=0.0,
      rating_threshold=1.0,
      seed=None,
      exclude_unknowns=True,
      verbose=False,
      **kwargs,
  ):
      super().__init__(
          data=data,
          fmt=fmt,
          rating_threshold=rating_threshold,
          seed=seed,
          exclude_unknowns=exclude_unknowns,
          verbose=verbose,
          **kwargs,
      )
  
      if group_by not in ["user", "item"]:
          raise ValueError(
              "group_by option must be either 'user' or 'item' but {}".format(
                  group_by
              )
          )
  
      if chrono and (fmt != "UIRT" or len(self.data[0]) != 4):
          raise ValueError(
              'Input data must be in "UIRT" format for sorting chronologically.'
          )
  
      self.chrono = chrono
      self.group_by = group_by
      self.val_size = val_size
      self.test_size = test_size
  
      self._split()
  
file_path: cornac/cornac/eval_methods/stratified_split.py
imports: from math import ceil
  from collections import defaultdict
  from .base_method import BaseMethod
  from .ratio_split import RatioSplit
  from ..utils import get_rng
  from ..utils.common import safe_indexing
label_desc: Use image node_id 1 to create a new StratifiedSplit object from inherited base classes: BaseMethod with example: obj = StratifiedSplit(data, group_by, chrono, fmt, test_size, val_size, rating_threshold, seed, exclude_unknowns, verbose)