Repository: scikit-learn/scikit-learn
Pull request: DOC fix docstring of EllipticEnvelope.fit
This commit updates the `fit(X, y)` definition, in the docs, of the `sklearn.covariance.EllipticEnvelope` class.  The original definition stated that parameter X could be of type `'array-like'` or `'sparse matrix'`, however, an error would be thrown if a 'sparse matrix' is passed (`TypeError: A sparse matrix was passed, but dense data is required.`).  To resolve this, `'sparse matrix'` was removed from the list of types X could be, in the docstring.

Fixes #14613 

Problem statement:
EllipticEnvelope does not work with a sparse matrix
The documentation for EllipticEnvelope fit method says:

> X : numpy array or sparse matrix, shape (n_samples, n_features).

However, when trying to fit with a sparse CSR matrix, an exception is thrown:

> TypeError: A sparse matrix was passed, but dense data is required. Use X.todense() to convert to a dense numpy array.

Hints from issue discussion:
Hi @kjanko , I'm sorry your issue got lost.... Please provide [self-contained example code](https://scikit-learn.org/dev/developers/minimal_reproducer.html#minimal-reproducer), including imports and data (if possible), so that other contributors can just run it and reproduce your issue. Ideally your example code should be minimal. Thanks for your understanding.
Thank you @cmarmo revisiting this issue. Here is a example of the code failing:

```python
from sklearn.covariance import EllipticEnvelope
from sklearn.datasets import make_regression
from scipy.sparse import csr_matrix

X, y = make_regression()
ee = EllipticEnvelope()

X_csr = csr_matrix(X)

# Raises TypeError: A sparse matrix was passed
ee.fit(X_csr)
```

To resolve this, we should update the the docstring and remove "sparse matrix" from it.
Hello @cmarmo & @thomasjpfan, I would like to pickup and complete this issue.

Commit message: Merge branch 'docs_refactor_EllipticEnvelope_fit' into main

This commit is part of the process to update the docs on the sklearn.covariance.EllipticEnvelope class's
fit(X, y) definition, as explained in issue #14613.

Patch to review:
diff --git a/sklearn/covariance/_elliptic_envelope.py b/sklearn/covariance/_elliptic_envelope.py
index 569e478e38ff4..6fb3efe32c56c 100644
--- a/sklearn/covariance/_elliptic_envelope.py
+++ b/sklearn/covariance/_elliptic_envelope.py
@@ -160,7 +160,7 @@ def fit(self, X, y=None):
 
         Parameters
         ----------
-        X : {array-like, sparse matrix} of shape (n_samples, n_features)
+        X : {array-like} of shape (n_samples, n_features)
             Training data.
 
         y : Ignored


Code review comments:
diff_hunk: @@ -160,7 +160,7 @@ def fit(self, X, y=None):
 
         Parameters
         ----------
-        X : {array-like, sparse matrix} of shape (n_samples, n_features)
+        X : {array-like} of shape (n_samples, n_features)
path: sklearn/covariance/_elliptic_envelope.py
text: @user1:
No need for the brackets when there's only a single option
```suggestion
        X : array-like of shape (n_samples, n_features)
```

@author:
Thank you @user1, I have updated the commit based on your suggestion.