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

Method fit_transform

sklearn/preprocessing/_label.py:107–122  ·  view source on GitHub ↗

Fit label encoder and return encoded labels. Parameters ---------- y : array-like of shape (n_samples,) Target values. Returns ------- y : array-like of shape (n_samples,) Encoded labels.

(self, y)

Source from the content-addressed store, hash-verified

105 return self
106
107 def fit_transform(self, y):
108 """Fit label encoder and return encoded labels.
109
110 Parameters
111 ----------
112 y : array-like of shape (n_samples,)
113 Target values.
114
115 Returns
116 -------
117 y : array-like of shape (n_samples,)
118 Encoded labels.
119 """
120 y = column_or_1d(y, warn=True)
121 self.classes_, y = _unique(y, return_inverse=True)
122 return y
123
124 def transform(self, y):
125 """Transform labels to normalized encoding.

Callers 15

cross_val_predictFunction · 0.95
fitMethod · 0.95
compute_class_weightFunction · 0.95
fitMethod · 0.95
_fit_encodings_allMethod · 0.95
test_label_encoderFunction · 0.95
silhouette_samplesFunction · 0.95
calinski_harabasz_scoreFunction · 0.95
davies_bouldin_scoreFunction · 0.95

Calls 2

column_or_1dFunction · 0.90
_uniqueFunction · 0.90