class_docstr: Defines a dataset composed of Examples along with its Fields.
  
  Attributes:
      sort_key (callable): A key to use for sorting dataset examples for batching
          together examples with similar lengths to minimize padding.
      examples (list(Example)): The examples in this dataset.
      fields (dict[str, Field]): Contains the name of each column or field, together
          with the corresponding Field object. Two fields with the same Field object
          will have a shared vocabulary.
docstr: Create train-test(-valid?) splits from the instance's examples.
  
  Arguments:
      split_ratio (float or List of floats): a number [0, 1] denoting the amount
          of data to be used for the training split (rest is used for test),
          or a list of numbers denoting the relative sizes of train, test and valid
          splits respectively. If the relative size for valid is missing, only the
          train-test split is returned. Default is 0.7 (for the train set).
      stratified (bool): whether the sampling should be stratified.
          Default is False.
      strata_field (str): name of the examples Field stratified over.
          Default is 'label' for the conventional label field.
      random_state (tuple): the random seed used for shuffling.
          A return value of `random.getstate()`.
  
  Returns:
      Tuple[Dataset]: Datasets for train, validation, and
      test splits in that order, if the splits are provided.
docstr_tok: ["Create","train-test","(","-valid","?",")","splits","from","the","instance","'s","examples",".","Arguments",":","split_ratio","(","float","or","List","of","floats",")",":","a","number","[","0",",","1","]","denoting","the","amount","of","data","to","be","used","for","the","training","split","(","rest","is","used","for","test",")",",","or","a","list","of","numbers","denoting","the","relative","sizes","of","train",",","test","and","valid","splits","respectively",".","If","the","relative","size","for","valid","is","missing",",","only","the","train-test","split","is","returned",".","Default","is","0.7","(","for","the","train","set",")",".","stratified","(","bool",")",":","whether","the","sampling","should","be","stratified",".","Default","is","False",".","strata_field","(","str",")",":","name","of","the","examples","Field","stratified","over",".","Default","is","'label","'","for","the","conventional","label","field",".","random_state","(","tuple",")",":","the","random","seed","used","for","shuffling",".","A","return","value","of","`","random.getstate","(",")","`",".","Returns",":","Tuple","[","Dataset","]",":","Datasets","for","train",",","validation",",","and","test","splits","in","that","order",",","if","the","splits","are","provided","."]
code: def split(
      self,
      split_ratio=0.7,
      stratified=False,
      strata_field="label",
      random_state=None,
  ):
      """Create train-test(-valid?) splits from the instance's examples.
  
      Arguments:
          split_ratio (float or List of floats): a number [0, 1] denoting the amount
              of data to be used for the training split (rest is used for test),
              or a list of numbers denoting the relative sizes of train, test and valid
              splits respectively. If the relative size for valid is missing, only the
              train-test split is returned. Default is 0.7 (for the train set).
          stratified (bool): whether the sampling should be stratified.
              Default is False.
          strata_field (str): name of the examples Field stratified over.
              Default is 'label' for the conventional label field.
          random_state (tuple): the random seed used for shuffling.
              A return value of `random.getstate()`.
  
      Returns:
          Tuple[Dataset]: Datasets for train, validation, and
          test splits in that order, if the splits are provided.
      """
      train_ratio, test_ratio, val_ratio = check_split_ratio(
          split_ratio
      )
  
      # For the permutations
      rnd = RandomShuffler(random_state)
      if not stratified:
          train_data, test_data, val_data = rationed_split(
              self.examples, train_ratio, test_ratio, val_ratio, rnd
          )
      else:
          if strata_field not in self.fields:
              raise ValueError(
                  "Invalid field name for strata_field {}".format(
                      strata_field
                  )
              )
          strata = stratify(self.examples, strata_field)
          train_data, test_data, val_data = [], [], []
          for group in strata:
              # Stratify each group and add together the indices.
              group_train, group_test, group_val = rationed_split(
                  group, train_ratio, test_ratio, val_ratio, rnd
              )
              train_data += group_train
              test_data += group_test
              val_data += group_val
  
      splits = tuple(
          Dataset(d, self.fields)
          for d in (train_data, val_data, test_data)
          if d
      )
  
      # In case the parent sort key isn't none
      if self.sort_key:
          for subset in splits:
              subset.sort_key = self.sort_key
      return splits
  
imports: import csv
  import gzip
  import io
  import os
  import shutil
  import tarfile
  import zipfile
  from functools import partial
  import torch.utils.data
  from torchtext.data.utils import RandomShuffler
  from torchtext.utils import download_from_url
  from .example import Example
label_desc: Use image node_id 3 for calling the Dataset obj's underlying member method code with example usage: obj.split(split_ratio, stratified, strata_field, random_state) and returns: splits