MCPcopy
hub / github.com/scikit-learn/scikit-learn / fit

Method fit

sklearn/preprocessing/_label.py:90–105  ·  view source on GitHub ↗

Fit label encoder. Parameters ---------- y : array-like of shape (n_samples,) Target values. Returns ------- self : returns an instance of self. Fitted label encoder.

(self, y)

Source from the content-addressed store, hash-verified

88 """
89
90 def fit(self, y):
91 """Fit label encoder.
92
93 Parameters
94 ----------
95 y : array-like of shape (n_samples,)
96 Target values.
97
98 Returns
99 -------
100 self : returns an instance of self.
101 Fitted label encoder.
102 """
103 y = column_or_1d(y, warn=True)
104 self.classes_ = _unique(y)
105 return self
106
107 def fit_transform(self, y):
108 """Fit label encoder and return encoded labels.

Callers 10

test_label_encoderFunction · 0.95
test_nan_label_encoderFunction · 0.95
matthews_corrcoefFunction · 0.95
hinge_lossFunction · 0.95

Calls 2

column_or_1dFunction · 0.90
_uniqueFunction · 0.90