'Learn empirical variances from X.
Parameters
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Sample vectors from which to compute variances.
y : any
Ignored. This parameter exists only for compatibility with
sklearn.pipeline.Pipeline.
Returns
self'

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

    X = check_array(X, ('csr', 'csc'), dtype=np.float64)
    if hasattr(X, 'toarray'):
        (_, self.variances_) = mean_variance_axis(X, axis=0)
    else:
        self.variances_ = np.var(X, axis=0)
    if np.all((self.variances_ <= self.threshold)):
        msg = 'No    feature    in    X    meets    the    variance    threshold    {0:.5f}'
        if (X.shape[0] == 1):
            msg += '    (X    contains    only    one    sample)'
        raise ValueError(msg.format(self.threshold))
    return self
