Provides get_feature_names_out for simple transformers.
This mixin assumes there’s a 1-to-1 correspondence between input features and output features, such as StandardScaler.
>>> import numpy as np >>> from sklearn.base import OneToOneFeatureMixin, BaseEstimator >>> class MyEstimator(OneToOneFeatureMixin, BaseEstimator): ... def fit(self, X, y=None): ... self.n_features_in_ = X.shape[1] ... return self >>> X = np.array([[1, 2], [3, 4]]) >>> MyEstimator().fit(X).get_feature_names_out() array(['x0', 'x1'], dtype=object)
Get output feature names for transformation.
Input features.
input_features is None, then feature_names_in_ is used as feature names in. If feature_names_in_ is not defined, then the following input feature names are generated: ["x0", "x1", ..., "x(n_features_in_ - 1)"].input_features is an array-like, then input_features must match feature_names_in_ if feature_names_in_ is defined.Same as input features.
© 2007–2025 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.6/modules/generated/sklearn.base.OneToOneFeatureMixin.html