Fit the underlying estimator.

        Parameters
        ----------
        X, y : array-like
        **kwargs
            Additional fit-kwargs for the underlying estimator.

        Returns
        -------
        self : object
197600
def fit(self, X, y=None, **kwargs):
        
        logger.info("Starting fit")
        with _timer("fit", _logger=logger):
            result = self.estimator.fit(X, y, **kwargs)

        # Copy over learned attributes
        copy_learned_attributes(result, self)
        copy_learned_attributes(result, self.estimator)
        return self
974866
def partial_fit(self, X, y, classes=None):
        
        return self.fit(X, y, epochs=1)
769730
def fit(self, X, y):
    '''
    '''
    X, y = self._prepare_inputs(X, y, ensure_min_samples=2)
    unique_classes, y = np.unique(y, return_inverse=True)
    n, d = X.shape
    num_classes = len(unique_classes)

    if self.num_dims is None:
      dim = d
    else:
      if not 0 < self.num_dims <= d:
        raise ValueError('Invalid num_dims, must be in [1,%d]' % d)
      dim = self.num_dims

    if self.k is None:
      k = min(7, d - 1)
    elif self.k >= d:
      warnings.warn('Chosen k (%d) too large, using %d instead.' % (self.k,d-1))
      k = d - 1
    else:
      k = int(self.k)
    tSb = np.zeros((d,d))
    tSw = np.zeros((d,d))

    for c in xrange(num_classes):
      Xc = X[y==c]
      nc = Xc.shape[0]

      # classwise affinity matrix
      dist = pairwise_distances(Xc, metric='l2', squared=True)
      # distances to k-th nearest neighbor
      k = min(k, nc - 1)
      sigma = np.sqrt(np.partition(dist, k, axis=0)[:, k])

      local_scale = np.outer(sigma, sigma)
      with np.errstate(divide='ignore', invalid='ignore'):
        A = np.exp(-dist/local_scale)
        A[local_scale==0] = 0

      G = Xc.T.dot(A.sum(axis=0)[:,None] * Xc) - Xc.T.dot(A).dot(Xc)
      tSb += G/n + (1-nc/n)*Xc.T.dot(Xc) + _sum_outer(Xc)/n
      tSw += G/nc

    tSb -= _sum_outer(X)/n - tSw

    # symmetrize
    tSb = (tSb + tSb.T) / 2
    tSw = (tSw + tSw.T) / 2

    vals, vecs = _eigh(tSb, tSw, dim)
    order = np.argsort(-vals)[:dim]
    vals = vals[order].real
    vecs = vecs[:,order]

    if self.embedding_type == 'weighted':
       vecs *= np.sqrt(vals)
    elif self.embedding_type == 'orthonormalized':
       vecs, _ = np.linalg.qr(vecs)

    self.transformer_ = vecs.T
    return self
1032425
def fit_transform(self, X, y, step_size=0.1, init_weights=None, warm_start=False):
        """"""
        self.fit(X=X, y=y, step_size=step_size, init_weights=init_weights, warm_start=warm_start)

        return self.transform(X=X)
212165
def _fit_regression(self, y):
        

        if self.regressor is None:
            self.coefs_ = safe_sparse_dot(pinv2(self.hidden_activations_), y)
        else:
            self.regressor.fit(self.hidden_activations_, y)

        self.fitted_ = True
974700
def fit(self, train_x, train_y):
        
        if self.first_fitted:
            self.incremental_fit(train_x, train_y)
        else:
            self.first_fit(train_x, train_y)
942232
def fit_transform(self, X, y):
        
        self.target_encoders = [None] * X.shape[1]
        self.target_mean = y.mean()

        for i, col in enumerate(X.columns):
            self.target_encoders[i] = self._get_target_encoder(X[col], y)

            X.loc[:, col] = X[col].fillna(NAN_INT).map(self.target_encoders[i]).fillna(self.target_mean)

        return X
492323
def fit_predict(self, X, y=None, **kwargs):
        
        return self.fit(X, **kwargs).predict(X, **kwargs)
1107568
def plot_fit(self,**kwargs):
        
        import matplotlib.pyplot as plt
        import seaborn as sns

        figsize = kwargs.get('figsize',(10,7))

        if self.latent_variables.estimated is False:
            raise Exception("No latent variables estimated!")
        else:
            date_index = self.index[self.lags:self.data[0].shape[0]]
            mu, Y = self._model(self.latent_variables.get_z_values())
            for series in range(0,Y.shape[0]):
                plt.figure(figsize=figsize)
                plt.plot(date_index,Y[series],label='Data ' + str(series))
                plt.plot(date_index,mu[series],label='Filter' + str(series),c='black')  
                plt.title(self.data_name[series])
                plt.legend(loc=2)   
            plt.show()
45976
def sub(x, y, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_sub,
        (
            BigFloat._implicit_convert(x),
            BigFloat._implicit_convert(y),
        ),
        context,
    )
1125515
def fit(self, X):
        
        self.centers_, self.labels_, self.sse_arr_, self.n_iter_ = \
              _kmedoids(X, self.n_clusters, self.distance, self.max_iter, self.n_trials, self.tol, self.rng)
261706
def fit(self, X, y):
        

        # note that GLM takes endog (y) and then exog (X):
        # this is the reverse of sklearn's methods
        self.glm_model = self.glm_partial(y, X)
        self.glm_results = self.glm_model.fit()
        return self
155462
def fit(self, X, y=None):
        
        # default to QuicGraphicalLassoCV
        estimator = self.estimator or QuicGraphicalLassoCV()

        self.lam_ = None
        self.estimator_ = None

        X = check_array(X, ensure_min_features=2, estimator=self)
        X = as_float_array(X, copy=False, force_all_finite=False)

        n_samples_, n_features_ = X.shape

        # perform first estimate
        estimator.fit(X)

        if self.method == "binary":
            # generate weights
            self.lam_ = self._binary_weights(estimator)

            # perform second step adaptive estimate
            self.estimator_ = QuicGraphicalLasso(
                lam=self.lam_ * estimator.lam_,
                mode="default",
                init_method="cov",
                auto_scale=False,
            )
            self.estimator_.fit(X)

        elif self.method == "inverse_squared":
            self.lam_ = self._inverse_squared_weights(estimator)

            # perform second step adaptive estimate
            self.estimator_ = QuicGraphicalLassoCV(
                lam=self.lam_ * self.estimator.lam_, auto_scale=False
            )
            self.estimator_.fit(X)

        elif self.method == "inverse":
            self.lam_ = self._inverse_weights(estimator)

            # perform second step adaptive estimate
            self.estimator_ = QuicGraphicalLassoCV(
                lam=self.lam_ * estimator.lam_, auto_scale=False
            )
            self.estimator_.fit(X)

        else:
            raise NotImplementedError(
                (
                    "Only method='binary', 'inverse_squared', or",
                    "'inverse' have been implemented.",
                )
            )

        self.is_fitted_ = True
        return self
168856
def fit(self, X, y=None):
        
        if self.normalize:
            X = normalize(X)

        self._check_force_weights()
        random_state = check_random_state(self.random_state)
        X = self._check_fit_data(X)

        (
            self.cluster_centers_,
            self.labels_,
            self.inertia_,
            self.weights_,
            self.concentrations_,
            self.posterior_,
        ) = movMF(
            X,
            self.n_clusters,
            posterior_type=self.posterior_type,
            force_weights=self.force_weights,
            n_init=self.n_init,
            n_jobs=self.n_jobs,
            max_iter=self.max_iter,
            verbose=self.verbose,
            init=self.init,
            random_state=random_state,
            tol=self.tol,
            copy_x=self.copy_x,
        )

        return self
337230
def fit_linear(X, y):
    
    model = linear_model.LinearRegression()
    model.fit(X, y)
    return model
1167708
def fit(self, X, y=None):
        
        self.unhasher.fit(self._get_terms_iter(X))
        return self
415143
def partial_fit(self, X):
        
        from pyemma.coordinates import source

        self._estimate(source(X), partial_fit=True)
        self._estimated = True

        return self