@@ -641,10 +641,12 @@ class AgglomerativeClustering(BaseEstimator, ClusterMixin):
641
641
- complete or maximum linkage uses the maximum distances between
642
642
all observations of the two sets.
643
643
644
- pooling_func : callable, default=np.mean
645
- This combines the values of agglomerated features into a single
646
- value, and should accept an array of shape [M, N] and the keyword
647
- argument ``axis=1``, and reduce it to an array of size [M].
644
+ pooling_func : callable, default='deprecated'
645
+ Ignored.
646
+
647
+ .. deprecated:: 0.20
648
+ ``pooling_func`` has been deprecated in 0.20 and will be removed
649
+ in 0.22.
648
650
649
651
Attributes
650
652
----------
@@ -670,7 +672,7 @@ class AgglomerativeClustering(BaseEstimator, ClusterMixin):
670
672
def __init__ (self , n_clusters = 2 , affinity = "euclidean" ,
671
673
memory = None ,
672
674
connectivity = None , compute_full_tree = 'auto' ,
673
- linkage = 'ward' , pooling_func = np . mean ):
675
+ linkage = 'ward' , pooling_func = 'deprecated' ):
674
676
self .n_clusters = n_clusters
675
677
self .memory = memory
676
678
self .connectivity = connectivity
@@ -694,6 +696,10 @@ def fit(self, X, y=None):
694
696
-------
695
697
self
696
698
"""
699
+ if self .pooling_func != 'deprecated' :
700
+ warnings .warn ('Agglomerative "pooling_func" parameter is not used.'
701
+ ' It has been deprecated in version 0.20 and will be'
702
+ 'removed in 0.22' , DeprecationWarning )
697
703
X = check_array (X , ensure_min_samples = 2 , estimator = self )
698
704
memory = check_memory (self .memory )
699
705
@@ -829,6 +835,16 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):
829
835
are merged to form node `n_features + i`
830
836
"""
831
837
838
+ def __init__ (self , n_clusters = 2 , affinity = "euclidean" ,
839
+ memory = None ,
840
+ connectivity = None , compute_full_tree = 'auto' ,
841
+ linkage = 'ward' , pooling_func = np .mean ):
842
+ super (FeatureAgglomeration , self ).__init__ (
843
+ n_clusters = n_clusters , memory = memory , connectivity = connectivity ,
844
+ compute_full_tree = compute_full_tree , linkage = linkage ,
845
+ affinity = affinity )
846
+ self .pooling_func = pooling_func
847
+
832
848
def fit (self , X , y = None , ** params ):
833
849
"""Fit the hierarchical clustering on the data
834
850
0 commit comments