class_docstr: Container to identify training set.
  
  Samples a random subset from set passed to the `fit` method, to allow
  identification of the training set in a `transform` or `predict` method.
  
  Parameters
  ----------
  size : int
      size to sample. A random subset of size [size, size] will be stored
      in the instance.
docstr: Sample a training set.
  
  Parameters
  ----------
  X: array-like
      training set to sample observations from.
  
  Returns
  ----------
  self: obj
      fitted instance with stored sample.
code: def fit(self, X):
      """Sample a training set.
  
      Parameters
      ----------
      X: array-like
          training set to sample observations from.
  
      Returns
      ----------
      self: obj
          fitted instance with stored sample.
      """
      self.train_shape = X.shape
  
      sample_idx = {}
      for i in range(2):
          dim_size = min(X.shape[i], self.size)
          sample_idx[i] = permutation(X.shape[i])[:dim_size]
  
      sample = X[ix_(sample_idx[0], sample_idx[1])]
  
      self.sample_idx_ = sample_idx
      self.sample_ = sample
  
      return self
  
file_path: mlens/mlens/utils/id_train.py
imports: from __future__ import division, print_function
  from ..utils.exceptions import NotFittedError
  from ..externals.sklearn.base import BaseEstimator
  from numpy import array_equal, ix_
  from numpy.random import permutation
  from numbers import Integral
label_desc: Use image node_id 2 for calling the IdTrain obj's underlying member method code with example usage: obj.fit(X) and returns: self