docstr: Given a database, this class is responsible for creating a training and test sets
  for k folds with well-known strategies:
  
  - k-fold cross-validation
  - ShuffleSplit
  
  Usage:
  
      >> SplitDatabase(input_file=database, dir_folds=dir_path, n_folds=10).k_fold_cross_validation()
      >> SplitDatabase(input_file=database, dir_folds=dir_path, n_folds=10).shuffle_split(test_size=0.3)
      # To use only one fold, you should use only shuffle_split. k_fold_cross_validation works only with
      # n_folds >= 2:
      >> SplitDatabase(input_file=database, dir_folds=dir_path, n_folds=1).shuffle_split(test_size=0.1)
  
  :param input_file: Input File with at least 2 columns.
  :type input_file: str
  
  :param dir_folds: Directory to write folds (train and test files)
  :type dir_folds: str
  
  :param n_splits: How much folds the strategy will divide
  :type n_splits: int, default 10
  
  :param sep_read: Delimiter for input files
  :type sep_read: str, default '  '
  
  :param sep_write: Delimiter for output files
  :type sep_write: str, default ' '
  
  :param header: Skip header line (only work with method: read_with_pandas)
  :type header: int, default None
  
  :param names: Name of columns (only work with method: read_with_pandas)
  :type names: str, default None
  
  :param as_binary: If True, the explicit feedback will be transform to binary
  :type as_binary: bool, default False
  
  :param binary_col: Index of columns to read as binary (only work with method: read_with_pandas)
  :type binary_col: int, default 2
  
  :param write_mode: Method to write file
  :type write_mode: str, default 'w'
code: def __init__(
      self,
      input_file,
      dir_folds=None,
      n_splits=10,
      sep_read="\t",
      sep_write="\t",
      header=None,
      names=None,
      as_binary=False,
      binary_col=None,
      write_mode="w",
  ):
      """
      Given a database, this class is responsible for creating a training and test sets
      for k folds with well-known strategies:
  
      - k-fold cross-validation
      - ShuffleSplit
  
      Usage:
  
          >> SplitDatabase(input_file=database, dir_folds=dir_path, n_folds=10).k_fold_cross_validation()
          >> SplitDatabase(input_file=database, dir_folds=dir_path, n_folds=10).shuffle_split(test_size=0.3)
          # To use only one fold, you should use only shuffle_split. k_fold_cross_validation works only with
          # n_folds >= 2:
          >> SplitDatabase(input_file=database, dir_folds=dir_path, n_folds=1).shuffle_split(test_size=0.1)
  
      :param input_file: Input File with at least 2 columns.
      :type input_file: str
  
      :param dir_folds: Directory to write folds (train and test files)
      :type dir_folds: str
  
      :param n_splits: How much folds the strategy will divide
      :type n_splits: int, default 10
  
      :param sep_read: Delimiter for input files
      :type sep_read: str, default '\t'
  
      :param sep_write: Delimiter for output files
      :type sep_write: str, default '\t'
  
      :param header: Skip header line (only work with method: read_with_pandas)
      :type header: int, default None
  
      :param names: Name of columns (only work with method: read_with_pandas)
      :type names: str, default None
  
      :param as_binary: If True, the explicit feedback will be transform to binary
      :type as_binary: bool, default False
  
      :param binary_col: Index of columns to read as binary (only work with method: read_with_pandas)
      :type binary_col: int, default 2
  
      :param write_mode: Method to write file
      :type write_mode: str, default 'w'
  
      """
  
      super(SplitDatabase, self).__init__(
          input_file,
          sep=sep_read,
          header=header,
          names=names,
          as_binary=as_binary,
          binary_col=binary_col,
      )
  
      self.dir_folds = dir_folds
      self.n_splits = n_splits
      self.sep_write = sep_write
      self.write_mode = write_mode
      self.df = self.read_with_pandas()
  
      if self.dir_folds is not None:
          self.create_folds()
  
file_path: CaseRecommender/caserec/utils/split_database.py
imports: from sklearn.model_selection import KFold, ShuffleSplit
  import os
  from caserec.utils.process_data import ReadFile, WriteFile
label_desc: Use image node_id 1 to create a new SplitDatabase object from inherited base classes: ReadFile with example: obj = SplitDatabase(input_file, dir_folds, n_splits, sep_read, sep_write, header, names, as_binary, binary_col, write_mode)