Repository: scikit-learn/scikit-learn
Pull request: FIX Remove **params from fit function for FeatureAgglomeration to get more concise error message
#### Reference Issues/PRs
Fixes: #20897 


#### What does this implement/fix? Explain your changes.
Removes the **kwargs parameter in `FeatureAgglomeration.fit` to result in a more concise error.

#### Any other comments?



Problem statement:
FeatureAgglomeration should accept a **kwargs in `fit` signature
### Describe the bug

`FeatureAgglomeration.fit` accepts a `**params` keyword argument. It is delegated to the `AgglomerativeClustering.fit` that does not accept any other parameter than `X` and `y`.

While it would already not work because an error would be raised by the `AgglomerativeClustering` estimator, it would be best to remove this `**params` from the documentation and the code such that we `FeatureAgglomeration` raises directly the error.

### Steps/Code to Reproduce

```python
In [1]: import numpy as np
   ...: from sklearn import datasets, cluster
   ...: digits = datasets.load_digits()
   ...: images = digits.images
   ...: X = np.reshape(images, (len(images), -1))
   ...: agglo = cluster.FeatureAgglomeration(n_clusters=32)
   ...: agglo.fit(X, whatever="xxx")
```

### Expected Results

```pytb
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-65a64bd30138> in <module>
----> 1 agglo.fit(X, whatever="xxx")

~/Documents/packages/scikit-learn/sklearn/cluster/_agglomerative.py in fit(self, X, y, **params)
   1231         # be overridden in AgglomerativeClustering since we passed it X.T.
   1232         n_features_in_ = self.n_features_in_
-> 1233         AgglomerativeClustering.fit(self, X.T, **params)
   1234         self.n_features_in_ = n_features_in_
   1235         return self

TypeError: fit() got an unexpected keyword argument 'whatever'
```

### Actual Results

Instead, we could have this more concise error:

```pytb
In [2]: agglo.fit(X, whatever="xxx")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-65a64bd30138> in <module>
----> 1 agglo.fit(X, whatever="xxx")

TypeError: fit() got an unexpected keyword argument 'whatever'
```

### Versions

```
System:
    python: 3.9.1 (default, Dec 11 2020, 14:32:07)  [GCC 7.3.0]
executable: /home/glemaitre/miniconda3/envs/dev/bin/python
   machine: Linux-5.8.0-63-generic-x86_64-with-glibc2.32

Python dependencies:
          pip: 21.1.2
   setuptools: 52.0.0.post20210125
      sklearn: 1.0.dev0
        numpy: 1.22.0.dev0+4.gb283e1632
        scipy: 1.7.0
       Cython: 3.0a7
       pandas: 1.2.1
   matplotlib: 3.3.4
       joblib: 1.0.0
threadpoolctl: 2.1.0

Built with OpenMP: True
```

Hints from issue discussion:
I can take this!

Commit message: Fix doc entry

Patch to review:
diff --git a/doc/whats_new/v1.0.rst b/doc/whats_new/v1.0.rst
index 42ada70c78049..2b8069d44194a 100644
--- a/doc/whats_new/v1.0.rst
+++ b/doc/whats_new/v1.0.rst
@@ -214,6 +214,10 @@ Changelog
   of connected components is greater than 1. :pr:`20597` by
   `Thomas Fan`_.
 
+- |Fix| :class:`cluster.FeatureAgglomeration` now does not take a ``**params``
+  kwarg in the ``fit`` function, resulting in a more concise error. :pr:`20899`
+  by :user:`Adam Li <adam2392>`.
+
 :mod:`sklearn.compose`
 ......................
 
diff --git a/sklearn/cluster/_agglomerative.py b/sklearn/cluster/_agglomerative.py
index 8c84b061f0490..974a53c47357e 100644
--- a/sklearn/cluster/_agglomerative.py
+++ b/sklearn/cluster/_agglomerative.py
@@ -1202,8 +1202,8 @@ def __init__(
         )
         self.pooling_func = pooling_func
 
-    def fit(self, X, y=None, **params):
-        """Fit the hierarchical clustering on the data.
+    def fit(self, X, y=None):
+        """Fit the hierarchical clustering on the data
 
         Parameters
         ----------
@@ -1213,9 +1213,6 @@ def fit(self, X, y=None, **params):
         y : Ignored
             Not used, present here for API consistency by convention.
 
-        **params : dictionary of keyword arguments
-            Additional fit parameters.
-
         Returns
         -------
         self : object
@@ -1230,7 +1227,7 @@ def fit(self, X, y=None, **params):
         # save n_features_in_ attribute here to reset it after, because it will
         # be overridden in AgglomerativeClustering since we passed it X.T.
         n_features_in_ = self.n_features_in_
-        AgglomerativeClustering.fit(self, X.T, **params)
+        AgglomerativeClustering.fit(self, X.T)
         self.n_features_in_ = n_features_in_
         return self
 


Code review comments:
diff_hunk: @@ -1202,8 +1202,8 @@ def __init__(
         )
         self.pooling_func = pooling_func
 
-    def fit(self, X, y=None, **params):
-        """Fit the hierarchical clustering on the data.
+    def fit(self, X, y=None):
+        """Fit the hierarchical clustering on the data
path: sklearn/cluster/_agglomerative.py
text: @user1:
```suggestion
        """Fit the hierarchical clustering on the data.
```