'Fit the model with X, using minibatches of size batch_size.
Parameters
X : array-like, shape (n_samples, n_features)
Training data, where n_samples is the number of samples and
n_features is the number of features.
y : Passthrough for ``Pipeline`` compatibility.
Returns
self : object
Returns the instance itself.'

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

    self.components_ = None
    self.n_samples_seen_ = 0
    self.mean_ = 0.0
    self.var_ = 0.0
    self.singular_values_ = None
    self.explained_variance_ = None
    self.explained_variance_ratio_ = None
    self.singular_values_ = None
    self.noise_variance_ = None
    X = check_array(X, copy=self.copy, dtype=[np.float64, np.float32])
    (n_samples, n_features) = X.shape
    if (self.batch_size is None):
        self.batch_size_ = (5 * n_features)
    else:
        self.batch_size_ = self.batch_size
    for batch in gen_batches(n_samples, self.batch_size_):
        self.partial_fit(X[batch], check_input=False)
    return self
