@@ -803,10 +803,6 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):
803
803
804
804
.. versionadded:: 1.2
805
805
806
- .. deprecated:: 1.4
807
- `metric=None` is deprecated in 1.4 and will be removed in 1.6.
808
- Let `metric` be the default value (i.e. `"euclidean"`) instead.
809
-
810
806
memory : str or object with the joblib.Memory interface, default=None
811
807
Used to cache the output of the computation of the tree.
812
808
By default, no caching is done. If a string is given, it is the
@@ -939,7 +935,6 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):
939
935
"metric" : [
940
936
StrOptions (set (_VALID_METRICS ) | {"precomputed" }),
941
937
callable ,
942
- Hidden (None ),
943
938
],
944
939
"memory" : [str , HasMethods ("cache" ), None ],
945
940
"connectivity" : ["array-like" , "sparse matrix" , callable , None ],
@@ -1008,20 +1003,6 @@ def _fit(self, X):
1008
1003
"""
1009
1004
memory = check_memory (self .memory )
1010
1005
1011
- # TODO(1.6): remove in 1.6
1012
- if self .metric is None :
1013
- warnings .warn (
1014
- (
1015
- "`metric=None` is deprecated in version 1.4 and will be removed in "
1016
- "version 1.6. Let `metric` be the default value "
1017
- "(i.e. `'euclidean'`) instead."
1018
- ),
1019
- FutureWarning ,
1020
- )
1021
- self ._metric = "euclidean"
1022
- else :
1023
- self ._metric = self .metric
1024
-
1025
1006
if not ((self .n_clusters is None ) ^ (self .distance_threshold is None )):
1026
1007
raise ValueError (
1027
1008
"Exactly one of n_clusters and "
@@ -1034,9 +1015,9 @@ def _fit(self, X):
1034
1015
"compute_full_tree must be True if distance_threshold is set."
1035
1016
)
1036
1017
1037
- if self .linkage == "ward" and self ._metric != "euclidean" :
1018
+ if self .linkage == "ward" and self .metric != "euclidean" :
1038
1019
raise ValueError (
1039
- f"{ self ._metric } was provided as metric. Ward can only "
1020
+ f"{ self .metric } was provided as metric. Ward can only "
1040
1021
"work with euclidean distances."
1041
1022
)
1042
1023
@@ -1070,7 +1051,7 @@ def _fit(self, X):
1070
1051
kwargs = {}
1071
1052
if self .linkage != "ward" :
1072
1053
kwargs ["linkage" ] = self .linkage
1073
- kwargs ["affinity" ] = self ._metric
1054
+ kwargs ["affinity" ] = self .metric
1074
1055
1075
1056
distance_threshold = self .distance_threshold
1076
1057
0 commit comments