Skip to content

DOC add n_features_in_ in the documentation #20236

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 22 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2d3cda4
DOC add versionadded in sklearn.cluster
glemaitre Jun 9, 2021
8b82628
iter
glemaitre Jun 9, 2021
3306d6c
DOC add n_features_in_ in sklearn.covariance
glemaitre Jun 9, 2021
6ac06be
DOC add n_features_in_ in sklearn.decomposition
glemaitre Jun 9, 2021
0da2e39
DOC add n_features_in_ in sklearn.discriminant_analysis
glemaitre Jun 9, 2021
599a86c
DOC add n_features_in_ in sklearn.dummy
glemaitre Jun 9, 2021
efc5af5
DOC add n_features_in_ in sklearn.ensemble
glemaitre Jun 9, 2021
6c00910
DOC add n_features_in_ in sklearn.feature_selection
glemaitre Jun 9, 2021
ec84149
DOC add n_features_in_ in sklearn.gaussian_process
glemaitre Jun 9, 2021
71048a9
DOC add n_features_in_ in sklearn.impute
glemaitre Jun 9, 2021
46fe928
DOC add n_features_in_ in sklearn.kernel_approximation
glemaitre Jun 9, 2021
bc9f47c
DOC add n_features_in_ in sklearn.kernel_ridge
glemaitre Jun 9, 2021
982fff7
DOC add n_features_in_ in sklearn.linear_model
glemaitre Jun 9, 2021
c4e6085
DOC add n_features_in_ for sklearn.manifold
glemaitre Jun 9, 2021
e70f382
DOC add n_features_in_ in sklearn.naive_bayes
glemaitre Jun 9, 2021
bb47bcb
DOC add n_features_in_ in sklearn.neighbors
glemaitre Jun 9, 2021
4e44013
DOC add n_features_in_ in sklearn.neural_network
glemaitre Jun 9, 2021
b1e9584
DOC add n_features_in_ in sklearn.preprocessing
glemaitre Jun 9, 2021
bfceb5a
DOC add n_features_in_ in sklearn.semi_supervised
glemaitre Jun 9, 2021
00a8826
DOC add n_features_in_ in sklearn.svm
glemaitre Jun 9, 2021
bf39fc0
DOC add n_features_in_ in sklearn.tree
glemaitre Jun 9, 2021
0c96c1b
DOC check doc parameters of HalvingSearchCV
glemaitre Jun 9, 2021
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
2 changes: 2 additions & 0 deletions sklearn/cluster/_affinity_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ class AffinityPropagation(ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Notes
-----
For an example, see :ref:`examples/cluster/plot_affinity_propagation.py
Expand Down
4 changes: 4 additions & 0 deletions sklearn/cluster/_agglomerative.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,8 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

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 @@ -1045,6 +1047,8 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

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
4 changes: 4 additions & 0 deletions sklearn/cluster/_bicluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ class SpectralCoclustering(BaseSpectral):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.cluster import SpectralCoclustering
Expand Down Expand Up @@ -401,6 +403,8 @@ class SpectralBiclustering(BaseSpectral):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.cluster import SpectralBiclustering
Expand Down
2 changes: 2 additions & 0 deletions sklearn/cluster/_birch.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ class Birch(ClusterMixin, TransformerMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

See Also
--------
MiniBatchKMeans : Alternative implementation that does incremental updates
Expand Down
2 changes: 2 additions & 0 deletions sklearn/cluster/_dbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ class DBSCAN(ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.cluster import DBSCAN
Expand Down
4 changes: 4 additions & 0 deletions sklearn/cluster/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,8 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

See Also
--------
MiniBatchKMeans : Alternative online implementation that does incremental
Expand Down Expand Up @@ -1471,6 +1473,8 @@ class MiniBatchKMeans(KMeans):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

See Also
--------
KMeans : The classic implementation of the clustering method based on the
Expand Down
2 changes: 2 additions & 0 deletions sklearn/cluster/_mean_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ class MeanShift(ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.cluster import MeanShift
Expand Down
2 changes: 2 additions & 0 deletions sklearn/cluster/_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ class OPTICS(ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

See Also
--------
DBSCAN : A similar clustering for a specified neighborhood radius (eps).
Expand Down
2 changes: 2 additions & 0 deletions sklearn/cluster/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ class SpectralClustering(ClusterMixin, BaseEstimator):
n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.cluster import SpectralClustering
Expand Down
5 changes: 5 additions & 0 deletions sklearn/covariance/_elliptic_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class EllipticEnvelope(OutlierMixin, MinCovDet):
Mahalanobis distances of the training set (on which :meth:`fit` is
called) observations.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
5 changes: 5 additions & 0 deletions sklearn/covariance/_empirical_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ class EmpiricalCovariance(BaseEstimator):
Estimated pseudo-inverse matrix.
(stored only if store_precision is True)

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
10 changes: 10 additions & 0 deletions sklearn/covariance/_graph_lasso.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ class GraphicalLasso(EmpiricalCovariance):
n_iter_ : int
Number of iterations run.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down Expand Up @@ -635,6 +640,11 @@ class GraphicalLassoCV(GraphicalLasso):
n_iter_ : int
Number of iterations run for the optimal alpha.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
5 changes: 5 additions & 0 deletions sklearn/covariance/_robust_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@ class MinCovDet(EmpiricalCovariance):
Mahalanobis distances of the training set (on which :meth:`fit` is
called) observations.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
15 changes: 15 additions & 0 deletions sklearn/covariance/_shrunk_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class ShrunkCovariance(EmpiricalCovariance):
Estimated pseudo inverse matrix.
(stored only if store_precision is True)

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down Expand Up @@ -356,6 +361,11 @@ class LedoitWolf(EmpiricalCovariance):
Coefficient in the convex combination used for the computation
of the shrunk estimate. Range is [0, 1].

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down Expand Up @@ -533,6 +543,11 @@ class OAS(EmpiricalCovariance):
coefficient in the convex combination used for the computation
of the shrunk estimate. Range is [0, 1].

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
10 changes: 10 additions & 0 deletions sklearn/decomposition/_dict_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,11 @@ class DictionaryLearning(_BaseSparseCoding, BaseEstimator):
error_ : array
vector of errors at each iteration

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

n_iter_ : int
Number of iterations run.

Expand Down Expand Up @@ -1492,6 +1497,11 @@ class MiniBatchDictionaryLearning(_BaseSparseCoding, BaseEstimator):
`A` `(n_components, n_components)` is the dictionary covariance matrix.
`B` `(n_features, n_components)` is the data approximation matrix.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

n_iter_ : int
Number of iterations run.

Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_factor_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ class FactorAnalysis(TransformerMixin, BaseEstimator):
mean_ : ndarray of shape (n_features,)
Per-feature empirical mean, estimated from the training set.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.datasets import load_digits
Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_fastica.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ def my_g(x):
mean_ : ndarray of shape(n_features,)
The mean over features. Only set if `self.whiten` is True.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

n_iter_ : int
If the algorithm is "deflation", n_iter is the
maximum number of iterations run across all components. Else
Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_incremental_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ class IncrementalPCA(_BasePCA):
batch_size_ : int
Inferred batch size from ``batch_size``.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.datasets import load_digits
Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_kernel_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ class KernelPCA(TransformerMixin, BaseEstimator):
The data used to fit the model. If `copy_X=False`, then `X_fit_` is
a reference. This attribute is used for the calls to transform.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.datasets import load_digits
Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_lda.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ class LatentDirichletAllocation(TransformerMixin, BaseEstimator):
n_batch_iter_ : int
Number of iterations of the EM step.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

n_iter_ : int
Number of passes over the dataset.

Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_nmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,11 @@ class NMF(TransformerMixin, BaseEstimator):
n_iter_ : int
Actual number of iterations.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ class PCA(_BasePCA):
Equal to the average of (min(n_features, n_samples) - n_components)
smallest eigenvalues of the covariance matrix of X.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

See Also
--------
KernelPCA : Kernel Principal Component Analysis.
Expand Down
10 changes: 10 additions & 0 deletions sklearn/decomposition/_sparse_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class SparsePCA(TransformerMixin, BaseEstimator):
Per-feature empirical mean, estimated from the training set.
Equal to ``X.mean(axis=0)``.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down Expand Up @@ -279,6 +284,11 @@ class MiniBatchSparsePCA(SparsePCA):
Per-feature empirical mean, estimated from the training set.
Equal to ``X.mean(axis=0)``.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> import numpy as np
Expand Down
5 changes: 5 additions & 0 deletions sklearn/decomposition/_truncated_svd.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class TruncatedSVD(TransformerMixin, BaseEstimator):
The singular values are equal to the 2-norms of the ``n_components``
variables in the lower-dimensional space.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.decomposition import TruncatedSVD
Expand Down
10 changes: 10 additions & 0 deletions sklearn/discriminant_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ class LinearDiscriminantAnalysis(LinearClassifierMixin,
classes_ : array-like of shape (n_classes,)
Unique class labels.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

See Also
--------
QuadraticDiscriminantAnalysis : Quadratic Discriminant Analysis.
Expand Down Expand Up @@ -732,6 +737,11 @@ class QuadraticDiscriminantAnalysis(ClassifierMixin, BaseEstimator):
classes_ : ndarray of shape (n_classes,)
Unique class labels.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
Expand Down
10 changes: 10 additions & 0 deletions sklearn/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
n_outputs_ : int
Number of outputs.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

sparse_output_ : bool
True if the array returned from predict is to be in sparse CSC format.
Is automatically set to True if the input y is passed in sparse format.
Expand Down Expand Up @@ -425,6 +430,11 @@ class DummyRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
Mean or median or quantile of the training targets or constant value
given by the user.

n_features_in_ : int
Number of features seen during :term:`fit`.

.. versionadded:: 0.24

n_outputs_ : int
Number of outputs.

Expand Down
Loading