class_docstr: Indexer that generates time series fold over ``X``.
  
  Sequential iterator that generates fold index tuples that preserve
  time series structure of data. Consequently, test folds always contain
  "future" observations (i.e. higher index values).
  
  The generator returns a tuple of stop and start positions to be used
  for numpy array slicing [stop:start].
  
  .. versionadded:: 0.2.3
  
  Parameters
  ----------
  step_size : int (default=1)
      number of samples to use in each test fold. The final window
      size may be smaller if too few observations remain.
  
  burn_in : int (default=None)
      number of samples to use for first training fold. These observations
      will be dropped from the output. Defaults to ``step_size``.
  
  window: int (default=None)
      number of previous samples to use in each training fold, except first
      which is determined by ``burn_in``. If ``None``, will use all previous
      observations.
  
  lag: int (default=0)
      distance between the most recent training point in the training fold and
      the first test point. For ``lag>0``, the training fold and the test fold
      will not be contiguous.
  
  X : array-like of shape [n_samples,] , optional
      the training set to partition. The training label array is also,
      accepted, as only the first dimension is used. If ``X`` is not
      passed at instantiating, the ``fit`` method must be called before
      ``generate``, or ``X`` must be passed as an argument of
      ``generate``.
  
  raise_on_exception : bool (default=True)
      whether to warn on suspicious slices or raise an error.
  
  See Also
  --------
  :class:`FoldIndex`, :class:`BlendIndex`, :class:`SubsetIndex`
  
  Examples
  --------
  
  >>> import numpy as np
  >>> from mlens.index import TemporalIndex
  >>> X = np.arange(10)
  >>> print("Data set: %r" % X)
  >>> print()
  >>>
  >>> idx = TemporalIndex(2, X=X)
  >>>
  >>> for train, test in idx.generate(as_array=True):
  ...     print('TRAIN IDX: %32r | TEST IDX: %16r' % (train, test))
  >>>
  >>> print()
  >>>
  >>> for train, test in idx.generate(as_array=True):
  ...     print('TRAIN SET: %32r | TEST SET: %16r' % (X[train], X[test]))
  >>>
  >>> for train_idx, test_idx in idx.generate(as_array=True):
  ...     assert max(train_idx) <= min(test_idx)
  >>>
  >>> print()
  >>>
  >>> print("No overlap between train set and test set.")
  Data set: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
  TRAIN IDX:                    array([0, 1]) | TEST IDX: array([2, 3, 4, 5, 6, 7, 8, 9])
  TRAIN IDX:              array([0, 1, 2, 3]) | TEST IDX: array([4, 5, 6, 7, 8, 9])
  TRAIN IDX:        array([0, 1, 2, 3, 4, 5]) | TEST IDX: array([6, 7, 8, 9])
  TRAIN IDX:  array([0, 1, 2, 3, 4, 5, 6, 7]) | TEST IDX:    array([8, 9])
  TRAIN SET:                    array([0, 1]) | TEST SET: array([2, 3, 4, 5, 6, 7, 8, 9])
  TRAIN SET:              array([0, 1, 2, 3]) | TEST SET: array([4, 5, 6, 7, 8, 9])
  TRAIN SET:        array([0, 1, 2, 3, 4, 5]) | TEST SET: array([6, 7, 8, 9])
  TRAIN SET:  array([0, 1, 2, 3, 4, 5, 6, 7]) | TEST SET:    array([8, 9])
  No overlap between train set and test set.
docstr: Method for storing array data.
  
  Parameters
  ----------
  X : array-like of shape [n_samples, optional]
      array to _collect dimension data from.
  y : None
      for compatibility
  job : None
      for compatibility
  
  Returns
  -------
  instance :
      indexer with stores sample size data.
docstr_tok: ["Method","for","storing","array","data",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","[","n_samples",",","optional","]","array","to","_collect","dimension","data","from",".","y",":","None","for","compatibility","job",":","None","for","compatibility","Returns","--","--","--","-","instance",":","indexer","with","stores","sample","size","data","."]
code: def fit(self, X, y=None, job=None):
      """Method for storing array data.
  
      Parameters
      ----------
      X : array-like of shape [n_samples, optional]
          array to _collect dimension data from.
      y : None
          for compatibility
      job : None
          for compatibility
  
      Returns
      -------
      instance :
          indexer with stores sample size data.
      """
      self.n_samples = X.shape[0]
      check_temporal_index(
          self.burn_in,
          self.step_size,
          self.window,
          self.lag,
          self.n_samples,
          self.raise_on_exception,
      )
      self.n_test_samples = self.n_samples - self.burn_in
      self.__fitted__ = True
      return self
  
file_path: mlens/mlens/index/temporal.py
imports: from __future__ import division
  from numbers import Integral
  import numpy
  from .base import BaseIndex
  from ._checks import check_temporal_index
label_desc: Use image node_id 2 for calling the TemporalIndex obj's underlying member method code with example usage: obj.fit(X, y, job) and returns: self