'Generate a sparse random projection matrix
Parameters
X : numpy array or scipy.sparse of shape [n_samples, n_features]
Training set: only the shape is used to find optimal random
matrix dimensions based on the theory referenced in the
afore mentioned papers.
y : is not used: placeholder to allow for usage in a Pipeline.
Returns
self'

def fit(self, X, y=None):

    X = check_array(X, accept_sparse=['csr', 'csc'])
    (n_samples, n_features) = X.shape
    if (self.n_components == 'auto'):
        self.n_components_ = johnson_lindenstrauss_min_dim(n_samples=n_samples, eps=self.eps)
        if (self.n_components_ <= 0):
            raise ValueError(('eps=%f    and    n_samples=%d    lead    to    a    target    dimension    of    %d    which    is    invalid' % (self.eps, n_samples, self.n_components_)))
        elif (self.n_components_ > n_features):
            raise ValueError(('eps=%f    and    n_samples=%d    lead    to    a    target    dimension    of    %d    which    is    larger    than    the    original    space    with    n_features=%d' % (self.eps, n_samples, self.n_components_, n_features)))
    else:
        if (self.n_components <= 0):
            raise ValueError(('n_components    must    be    greater    than    0,    got    %s' % self.n_components))
        elif (self.n_components > n_features):
            warnings.warn(('The    number    of    components    is    higher    than    the    number    of    features:    n_features    <    n_components    (%s    <    %s).The    dimensionality    of    the    problem    will    not    be    reduced.' % (n_features, self.n_components)), DataDimensionalityWarning)
        self.n_components_ = self.n_components
    self.components_ = self._make_random_matrix(self.n_components_, n_features)
    assert_equal(self.components_.shape, (self.n_components_, n_features), err_msg='An    error    has    occurred    the    self.components_    matrix    has        not    the    proper    shape.')
    return self
