Skip to content

DOC Ensures that MinCovDet passes numpydoc validation #20580

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 2 commits into from
Jul 21, 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
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"MDS",
"MLPRegressor",
"MeanShift",
"MinCovDet",
"MiniBatchDictionaryLearning",
"MiniBatchKMeans",
"MiniBatchSparsePCA",
Expand Down
40 changes: 27 additions & 13 deletions sklearn/covariance/_robust_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,31 @@ class MinCovDet(EmpiricalCovariance):

.. versionadded:: 0.24

See Also
--------
EllipticEnvelope : An object for detecting outliers in
a Gaussian distributed dataset.
EmpiricalCovariance : Maximum likelihood covariance estimator.
GraphicalLasso : Sparse inverse covariance estimation
with an l1-penalized estimator.
GraphicalLassoCV : Sparse inverse covariance with cross-validated
choice of the l1 penalty.
LedoitWolf : LedoitWolf Estimator.
OAS : Oracle Approximating Shrinkage Estimator.
ShrunkCovariance : Covariance estimator with shrinkage.

References
----------

.. [Rouseeuw1984] P. J. Rousseeuw. Least median of squares regression.
J. Am Stat Ass, 79:871, 1984.
.. [Rousseeuw] A Fast Algorithm for the Minimum Covariance Determinant
Estimator, 1999, American Statistical Association and the American
Society for Quality, TECHNOMETRICS
.. [ButlerDavies] R. W. Butler, P. L. Davies and M. Jhun,
Asymptotics For The Minimum Covariance Determinant Estimator,
The Annals of Statistics, 1993, Vol. 21, No. 3, 1385-1400

Examples
--------
>>> import numpy as np
Expand All @@ -665,18 +690,6 @@ class MinCovDet(EmpiricalCovariance):
[0.2535..., 0.3053...]])
>>> cov.location_
array([0.0813... , 0.0427...])

References
----------

.. [Rouseeuw1984] P. J. Rousseeuw. Least median of squares regression.
J. Am Stat Ass, 79:871, 1984.
.. [Rousseeuw] A Fast Algorithm for the Minimum Covariance Determinant
Estimator, 1999, American Statistical Association and the American
Society for Quality, TECHNOMETRICS
.. [ButlerDavies] R. W. Butler, P. L. Davies and M. Jhun,
Asymptotics For The Minimum Covariance Determinant Estimator,
The Annals of Statistics, 1993, Vol. 21, No. 3, 1385-1400
"""

_nonrobust_covariance = staticmethod(empirical_covariance)
Expand All @@ -695,7 +708,7 @@ def __init__(
self.random_state = random_state

def fit(self, X, y=None):
"""Fits a Minimum Covariance Determinant with the FastMCD algorithm.
"""Fit a Minimum Covariance Determinant with the FastMCD algorithm.

Parameters
----------
Expand All @@ -709,6 +722,7 @@ def fit(self, X, y=None):
Returns
-------
self : object
Returns the instance itself.
"""
X = self._validate_data(X, ensure_min_samples=2, estimator="MinCovDet")
random_state = check_random_state(self.random_state)
Expand Down