class_docstr: Util class for dividing dataset based on task type
  * If it's regression task, it's not difficult to split data
  * If it's classification task, we need to split data based on the labels, because we need to:
    * ensure the divided data contain all labels available
    * ensure the label distribution is identical across all divided data.
  
  Examples
  --------
  >>> import numpy as np
  >>>
  >>> from cflearn.data.ml.utils import DataSplitter
  >>>
  >>> x = np.arange(12).reshape([6, 2])
  >>> # create an imbalance dataset
  >>> y = np.zeros(6, int)
  >>> y[[-1, -2]] = 1
  >>> splitter = DataSplitter()
  >>> # labels in result will keep its ratio
  >>> result = splitter.split(x, y, 3)
  >>> print(result.y.ravel())  # [0 0 1]
  >>> result = splitter.split(x, y, 0.5)
  >>> print(result.y.ravel())  # [0 0 1]
  >>> # at least one sample of each class will be kept
  >>> y[-2] = 0
  >>> result = splitter.split(x, y, 2)
  >>> # [0 0 0 0 0 1] [0 1]
  >>> print(y, result.dataset.y.ravel())
class_docstr_tok: ["Util","class","for","dividing","dataset","based","on","task","type","*","If","it","'s","regression","task",",","it","'s","not","difficult","to","split","data","*","If","it","'s","classification","task",",","we","need","to","split","data","based","on","the","labels",",","because","we","need","to",":","*","ensure","the","divided","data","contain","all","labels","available","*","ensure","the","label","distribution","is","identical","across","all","divided","data",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">",">",">",">","from","cflearn.data.ml.utils","import","DataSplitter",">",">",">",">",">",">","x","=","np.arange","(","12",")",".reshape","(","[","6",",","2","]",")",">",">",">","#","create","an","imbalance","dataset",">",">",">","y","=","np.zeros","(","6",",","int",")",">",">",">","y","[","[","-1",",","-2","]","]","=","1",">",">",">","splitter","=","DataSplitter","(",")",">",">",">","#","labels","in","result","will","keep","its","ratio",">",">",">","result","=","splitter.split","(","x",",","y",",","3",")",">",">",">","print","(","result.y.ravel","(",")",")","#","[","0","0","1","]",">",">",">","result","=","splitter.split","(","x",",","y",",","0.5",")",">",">",">","print","(","result.y.ravel","(",")",")","#","[","0","0","1","]",">",">",">","#","at","least","one","sample","of","each","class","will","be","kept",">",">",">","y","[","-2","]","=","0",">",">",">","result","=","splitter.split","(","x",",","y",",","2",")",">",">",">","#","[","0","0","0","0","0","1","]","[","0","1","]",">",">",">","print","(","y",",","result.dataset.y.ravel","(",")",")"]
code: def order(self) -> DataOrder:
      return self._order
  
imports: import numpy
  from enum import Enum
  from typing import Any
  from typing import Dict
  from typing import List
  from typing import Tuple
  from typing import Union
  from typing import Optional
  from typing import NamedTuple
  from dataclasses import dataclass
  from cftool.misc import print_warning
  from cftool.array import is_float
  from cftool.array import get_unique_indices
  from .recognizer import RecognizerBlock
  from ....schema import DataBundle
  from ....schema import ColumnTypes
  from ....schema import INoInitDataBlock
label_desc: Use image node_id 3 for calling the DataSplitter obj's underlying member method code with example usage: obj.order() and returns: self