MCPcopy Index your code
hub / github.com/scikit-learn/scikit-learn / fit

Method fit

sklearn/preprocessing/_encoders.py:982–1007  ·  view source on GitHub ↗

Fit OneHotEncoder to X. Parameters ---------- X : array-like of shape (n_samples, n_features) The data to determine the categories of each feature. y : None Ignored. This parameter exists only for compatibility with :clas

(self, X, y=None)

Source from the content-addressed store, hash-verified

980
981 @_fit_context(prefer_skip_nested_validation=True)
982 def fit(self, X, y=None):
983 """
984 Fit OneHotEncoder to X.
985
986 Parameters
987 ----------
988 X : array-like of shape (n_samples, n_features)
989 The data to determine the categories of each feature.
990
991 y : None
992 Ignored. This parameter exists only for compatibility with
993 :class:`~sklearn.pipeline.Pipeline`.
994
995 Returns
996 -------
997 self
998 Fitted encoder.
999 """
1000 self._fit(
1001 X,
1002 handle_unknown=self.handle_unknown,
1003 ensure_all_finite="allow-nan",
1004 )
1005 self._set_drop_idx()
1006 self._n_features_outs = self._compute_n_features_outs()
1007 return self
1008
1009 def transform(self, X):
1010 """

Calls 3

_set_drop_idxMethod · 0.95
_fitMethod · 0.45