class_docstr: Subset of a base dataset.
  
  SubDataset defines a subset of a given base dataset. The subset is defined
  as an interval of indexes, optionally with a given permutation.
  
  If ``order`` is given, then the ``i``-th example of this dataset is the
  ``order[start + i]``-th example of the base dataset, where ``i`` is a
  non-negative integer. If ``order`` is not given, then the ``i``-th example
  of this dataset is the ``start + i``-th example of the base dataset.
  Negative indexing is also allowed: in this case, the term ``start + i`` is
  replaced by ``finish + i``.
  
  SubDataset is often used to split a dataset into training and validation
  subsets. The training set is used for training, while the validation set is
  used to track the generalization performance, i.e. how the learned model
  works well on unseen data. We can tune hyperparameters (e.g. number of
  hidden units, weight initializers, learning rate, etc.) by comparing the
  validation performance. Note that we often use another set called test set
  to measure the quality of the tuned hyperparameter, which can be made by
  nesting multiple SubDatasets.
  
  There are two ways to make training-validation splits. One is a single
  split, where the dataset is split just into two subsets. It can be done by
  :func:`split_dataset` or :func:`split_dataset_random`. The other one is a
  :math:`k`-fold cross validation, in which the dataset is divided into
  :math:`k` subsets, and :math:`k` different splits are generated using each
  of the :math:`k` subsets as a validation set and the rest as a training
  set. It can be done by :func:`get_cross_validation_datasets`.
  
  Args:
      dataset: Base dataset.
      start (int): The first index in the interval.
      finish (int): The next-to-the-last index in the interval.
      order (sequence of ints): Permutation of indexes in the base dataset.
          If this is ``None``, then the ascending order of indexes is used.
class_docstr_tok: ["Subset","of","a","base","dataset",".","SubDataset","defines","a","subset","of","a","given","base","dataset",".","The","subset","is","defined","as","an","interval","of","indexes",",","optionally","with","a","given","permutation",".","If","``","order","``","is","given",",","then","the","``","i","``","-th","example","of","this","dataset","is","the","``","order","[","start","+","i","]","``","-th","example","of","the","base","dataset",",","where","``","i","``","is","a","non-negative","integer",".","If","``","order","``","is","not","given",",","then","the","``","i","``","-th","example","of","this","dataset","is","the","``","start","+","i","``","-th","example","of","the","base","dataset",".","Negative","indexing","is","also","allowed",":","in","this","case",",","the","term","``","start","+","i","``","is","replaced","by","``","finish","+","i","``",".","SubDataset","is","often","used","to","split","a","dataset","into","training","and","validation","subsets",".","The","training","set","is","used","for","training",",","while","the","validation","set","is","used","to","track","the","generalization","performance",",","i.e",".","how","the","learned","model","works","well","on","unseen","data",".","We","can","tune","hyperparameters","(","e.g",".","number","of","hidden","units",",","weight","initializers",",","learning","rate",",","etc",".",")","by","comparing","the","validation","performance",".","Note","that","we","often","use","another","set","called","test","set","to","measure","the","quality","of","the","tuned","hyperparameter",",","which","can","be","made","by","nesting","multiple","SubDatasets",".","There","are","two","ways","to","make","training-validation","splits",".","One","is","a","single","split",",","where","the","dataset","is","split","just","into","two","subsets",".","It","can","be","done","by",":","func",":","`","split_dataset","`","or",":","func",":","`","split_dataset_random","`",".","The","other","one","is","a",":","math",":","`","k","`","-fold","cross","validation",",","in","which","the","dataset","is","divided","into",":","math",":","`","k","`","subsets",",","and",":","math",":","`","k","`","different","splits","are","generated","using","each","of","the",":","math",":","`","k","`","subsets","as","a","validation","set","and","the","rest","as","a","training","set",".","It","can","be","done","by",":","func",":","`","get_cross_validation_datasets","`",".","Args",":","dataset",":","Base","dataset",".","start","(","int",")",":","The","first","index","in","the","interval",".","finish","(","int",")",":","The","next-to-the-last","index","in","the","interval",".","order","(","sequence","of","ints",")",":","Permutation","of","indexes","in","the","base","dataset",".","If","this","is","``","None","``",",","then","the","ascending","order","of","indexes","is","used","."]
code: def get_example(self, i):
      if i >= 0:
          if i >= self._size:
              raise IndexError("dataset index out of range")
          index = self._start + i
      else:
          if i < -self._size:
              raise IndexError("dataset index out of range")
          index = self._finish + i
  
      if self._order is not None:
          index = self._order[index]
      return self._dataset[index]
  
file_path: chainer/chainer/datasets/sub_dataset.py
imports: import numpy
  import six
  import warnings
  from chainer.dataset import dataset_mixin
label_desc: Use image node_id 3 for calling the SubDataset obj's underlying member method code with example usage: obj.get_example(i) and returns: self