Skip to content

DOC Adds feature_names_in_ to docstrings #20787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sklearn/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ class CalibratedClassifierCV(ClassifierMixin, MetaEstimatorMixin, BaseEstimator)

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Only defined if the
underlying base_estimator exposes such an attribute when fit.

.. versionadded:: 1.0

calibrated_classifiers_ : list (len() equal to cv or 1 if `cv="prefit"` \
or `ensemble=False`)
The list of classifier and calibrator pairs.
Expand Down
6 changes: 6 additions & 0 deletions sklearn/cluster/_affinity_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ class AffinityPropagation(ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
AgglomerativeClustering : Recursively merges the pair of
Expand Down
12 changes: 12 additions & 0 deletions sklearn/cluster/_agglomerative.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,12 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

children_ : array-like of shape (n_samples-1, 2)
The children of each non-leaf node. Values less than `n_samples`
correspond to leaves of the tree which are the original samples.
Expand Down Expand Up @@ -1098,6 +1104,12 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

children_ : array-like of shape (n_nodes-1, 2)
The children of each non-leaf node. Values less than `n_features`
correspond to leaves of the tree which are the original samples.
Expand Down
12 changes: 12 additions & 0 deletions sklearn/cluster/_bicluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ class SpectralCoclustering(BaseSpectral):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.cluster import SpectralCoclustering
Expand Down Expand Up @@ -427,6 +433,12 @@ class SpectralBiclustering(BaseSpectral):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.cluster import SpectralBiclustering
Expand Down
6 changes: 6 additions & 0 deletions sklearn/cluster/_birch.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ class Birch(ClusterMixin, TransformerMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
MiniBatchKMeans : Alternative implementation that does incremental updates
Expand Down
6 changes: 6 additions & 0 deletions sklearn/cluster/_dbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ class DBSCAN(ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
OPTICS : A similar clustering at multiple values of eps. Our implementation
Expand Down
12 changes: 12 additions & 0 deletions sklearn/cluster/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,12 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
MiniBatchKMeans : Alternative online implementation that does incremental
Expand Down Expand Up @@ -1620,6 +1626,12 @@ class MiniBatchKMeans(KMeans):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
KMeans : The classic implementation of the clustering method based on the
Expand Down
6 changes: 6 additions & 0 deletions sklearn/cluster/_mean_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ class MeanShift(ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.cluster import MeanShift
Expand Down
6 changes: 6 additions & 0 deletions sklearn/cluster/_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ class OPTICS(ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
DBSCAN : A similar clustering for a specified neighborhood radius (eps).
Expand Down
6 changes: 6 additions & 0 deletions sklearn/cluster/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ class SpectralClustering(ClusterMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.cluster import SpectralClustering
Expand Down
6 changes: 6 additions & 0 deletions sklearn/covariance/_elliptic_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ class EllipticEnvelope(OutlierMixin, MinCovDet):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
EmpiricalCovariance : Maximum likelihood covariance estimator.
Expand Down
6 changes: 6 additions & 0 deletions sklearn/covariance/_empirical_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ class EmpiricalCovariance(BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
EllipticEnvelope : An object for detecting outliers in
Expand Down
12 changes: 12 additions & 0 deletions sklearn/covariance/_graph_lasso.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ class GraphicalLasso(EmpiricalCovariance):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
graphical_lasso : L1-penalized covariance estimator.
Expand Down Expand Up @@ -760,6 +766,12 @@ class GraphicalLassoCV(GraphicalLasso):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
graphical_lasso : L1-penalized covariance estimator.
Expand Down
6 changes: 6 additions & 0 deletions sklearn/covariance/_robust_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,12 @@ class MinCovDet(EmpiricalCovariance):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
EllipticEnvelope : An object for detecting outliers in
Expand Down
18 changes: 18 additions & 0 deletions sklearn/covariance/_shrunk_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ class ShrunkCovariance(EmpiricalCovariance):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
EllipticEnvelope : An object for detecting outliers in
Expand Down Expand Up @@ -386,6 +392,12 @@ class LedoitWolf(EmpiricalCovariance):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
EllipticEnvelope : An object for detecting outliers in
Expand Down Expand Up @@ -585,6 +597,12 @@ class OAS(EmpiricalCovariance):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
EllipticEnvelope : An object for detecting outliers in
Expand Down
24 changes: 24 additions & 0 deletions sklearn/cross_decomposition/_pls.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,12 @@ class PLSRegression(_PLS):
n_features_in_ : int
Number of features seen during :term:`fit`.

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.cross_decomposition import PLSRegression
Expand Down Expand Up @@ -736,6 +742,12 @@ class PLSCanonical(_PLS):
n_features_in_ : int
Number of features seen during :term:`fit`.

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.cross_decomposition import PLSCanonical
Expand Down Expand Up @@ -858,6 +870,12 @@ class CCA(_PLS):
n_features_in_ : int
Number of features seen during :term:`fit`.

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

See Also
--------
PLSCanonical : Partial Least Squares transformer and regressor.
Expand Down Expand Up @@ -944,6 +962,12 @@ class PLSSVD(TransformerMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> import numpy as np
Expand Down
18 changes: 18 additions & 0 deletions sklearn/decomposition/_dict_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,12 @@ class SparseCoder(_BaseSparseCoding, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> import numpy as np
Expand Down Expand Up @@ -1432,6 +1438,12 @@ class DictionaryLearning(_BaseSparseCoding, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

n_iter_ : int
Number of iterations run.

Expand Down Expand Up @@ -1694,6 +1706,12 @@ class MiniBatchDictionaryLearning(_BaseSparseCoding, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

n_iter_ : int
Number of iterations run.

Expand Down
6 changes: 6 additions & 0 deletions sklearn/decomposition/_factor_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ class FactorAnalysis(TransformerMixin, BaseEstimator):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

Examples
--------
>>> from sklearn.datasets import load_digits
Expand Down
6 changes: 6 additions & 0 deletions sklearn/decomposition/_fastica.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ def my_g(x):

.. versionadded:: 0.24

feature_names_in_ : ndarray of shape (`n_features_in_`,)
Names of features seen during :term:`fit`. Defined only when `X`
has feature names that are all strings.

.. versionadded:: 1.0

n_iter_ : int
If the algorithm is "deflation", n_iter is the
maximum number of iterations run across all components. Else
Expand Down
Loading