Repository: graspologic-org/graspologic

Issue:
[BUG] Deprecation warning in AutoGMM
## Expected Behavior
No warning

## Actual Behavior
Deprecation warning in `AutoGMM`

## Example Code
```
from graspologic.cluster import AutoGMM
```

## Full Traceback
```pytb
FutureWarning: The sklearn.utils.testing module is deprecated in version 0.22 and will be removed in version 0.24. 
The corresponding classes / functions should instead be imported from sklearn.utils. 
Anything that cannot be imported from sklearn.utils is now part of the private API.
```

## Solution 
Caused by https://github.com/microsoft/graspologic/blob/8d7d29f0e569de4b1969d3b1aed8d47168aa6a96/graspologic/cluster/autogmm.py#L14

Just need to replace that decorator with a simple 
```
with warnings.simplefilter('ignore', ConvergenceWarning):
```
(I think)


Discussion:
Hi @bdpedigo ! I'm new to open source and I would like to work on this issue.
🎉 Hi @darkyed, that is great to hear! Does the issue make sense? Is there anything you need from us to get started? We are happy to help you get going on this however we can.

The goal is basically to use Python's `warnings` package to suppress `ConvergenceWarnings` in the method `fit` of the class `AutoGMM`. Currently this was done by using some code from sklearn that was private and is no longer available to us, but we should just be using `warnings` to do this anyway.

Note: I am somewhat on vacation till Jan. 4th so may be slow to reply until then.
> Hi @bdpedigo ! I'm new to open source and I would like to work on this issue.

@darkyed I am also curious how you found our project - we have recently been trying to encourage more open source contributions by adding ourselves to a few lists of "good first issues," just curious if you found the package that way or some other way. Thanks!
welcome @darkyed, happy to be working together!

Resolving patch:
diff --git a/graspologic/cluster/autogmm.py b/graspologic/cluster/autogmm.py
--- a/graspologic/cluster/autogmm.py
+++ b/graspologic/cluster/autogmm.py
@@ -11,8 +11,9 @@
     _estimate_gaussian_parameters,
 )
 from sklearn.model_selection import ParameterGrid
-from sklearn.utils._testing import ignore_warnings
+
 from sklearn.exceptions import ConvergenceWarning
+
 from joblib import Parallel, delayed
 import warnings
 
@@ -375,9 +376,6 @@ def __init__(
         self.max_agglom_size = max_agglom_size
         self.n_jobs = n_jobs
 
-    # ignoring warning here because if convergence is not reached, the regularization
-    # is automatically increased
-    @ignore_warnings(category=ConvergenceWarning)
     def _fit_cluster(self, X, y, params):
         label_init = self.label_init
         if label_init is not None:
@@ -418,7 +416,11 @@ def _fit_cluster(self, X, y, params):
         while gm_params["reg_covar"] <= 1 and criter == np.inf:
             model = GaussianMixture(**gm_params)
             try:
-                model.fit(X)
+                # ignoring warning here because if convergence is not reached, the regularization
+                # is automatically increased
+                with warnings.catch_warnings():
+                    warnings.simplefilter("ignore", ConvergenceWarning)
+                    model.fit(X)
                 predictions = model.predict(X)
                 counts = [
                     sum(predictions == i) for i in range(gm_params["n_components"])


Test patch: