@@ -86,8 +86,7 @@ def _fix_connectivity(X, connectivity, n_components=None,
8686###############################################################################
8787# Hierarchical tree building functions
8888
89- def ward_tree (X , connectivity = None , n_components = None , n_clusters = None ,
90- return_distance = False ):
89+ def ward_tree (X , connectivity = None , n_clusters = None , return_distance = False ):
9190 """Ward clustering based on a Feature matrix.
9291
9392 Recursively merges the pair of clusters that minimally increases
@@ -111,12 +110,6 @@ def ward_tree(X, connectivity=None, n_components=None, n_clusters=None,
111110 be symmetric and only the upper triangular half is used.
112111 Default is None, i.e, the Ward algorithm is unstructured.
113112
114- n_components : int (optional)
115- Number of connected components. If None the number of connected
116- components is estimated from the connectivity matrix.
117- NOTE: This parameter is now directly determined directly
118- from the connectivity matrix and will be removed in 0.18
119-
120113 n_clusters : int (optional)
121114 Stop early the construction of the tree at n_clusters. This is
122115 useful to decrease computation time if the number of clusters is
@@ -199,11 +192,6 @@ def ward_tree(X, connectivity=None, n_components=None, n_clusters=None,
199192 else :
200193 return children_ , 1 , n_samples , None
201194
202- if n_components is not None :
203- warnings .warn (
204- "n_components is now directly calculated from the connectivity "
205- "matrix and will be removed in 0.18" ,
206- DeprecationWarning )
207195 connectivity , n_components = _fix_connectivity (X , connectivity )
208196 if n_clusters is None :
209197 n_nodes = 2 * n_samples - 1
@@ -326,12 +314,6 @@ def linkage_tree(X, connectivity=None, n_components=None,
326314 be symmetric and only the upper triangular half is used.
327315 Default is None, i.e, the Ward algorithm is unstructured.
328316
329- n_components : int (optional)
330- Number of connected components. If None the number of connected
331- components is estimated from the connectivity matrix.
332- NOTE: This parameter is now directly determined directly
333- from the connectivity matrix and will be removed in 0.18
334-
335317 n_clusters : int (optional)
336318 Stop early the construction of the tree at n_clusters. This is
337319 useful to decrease computation time if the number of clusters is
@@ -435,11 +417,6 @@ def linkage_tree(X, connectivity=None, n_components=None,
435417 return children_ , 1 , n_samples , None , distances
436418 return children_ , 1 , n_samples , None
437419
438- if n_components is not None :
439- warnings .warn (
440- "n_components is now directly calculated from the connectivity "
441- "matrix and will be removed in 0.18" ,
442- DeprecationWarning )
443420 connectivity , n_components = _fix_connectivity (X , connectivity )
444421
445422 connectivity = connectivity .tocoo ()
@@ -636,12 +613,6 @@ class AgglomerativeClustering(BaseEstimator, ClusterMixin):
636613 By default, no caching is done. If a string is given, it is the
637614 path to the caching directory.
638615
639- n_components : int (optional)
640- Number of connected components. If None the number of connected
641- components is estimated from the connectivity matrix.
642- NOTE: This parameter is now directly determined from the connectivity
643- matrix and will be removed in 0.18
644-
645616 compute_full_tree : bool or 'auto' (optional)
646617 Stop early the construction of the tree at n_clusters. This is
647618 useful to decrease computation time if the number of clusters is
@@ -689,12 +660,10 @@ class AgglomerativeClustering(BaseEstimator, ClusterMixin):
689660
690661 def __init__ (self , n_clusters = 2 , affinity = "euclidean" ,
691662 memory = Memory (cachedir = None , verbose = 0 ),
692- connectivity = None , n_components = None ,
693- compute_full_tree = 'auto' , linkage = 'ward' ,
694- pooling_func = np .mean ):
663+ connectivity = None , compute_full_tree = 'auto' ,
664+ linkage = 'ward' , pooling_func = np .mean ):
695665 self .n_clusters = n_clusters
696666 self .memory = memory
697- self .n_components = n_components
698667 self .connectivity = connectivity
699668 self .compute_full_tree = compute_full_tree
700669 self .linkage = linkage
@@ -760,7 +729,6 @@ def fit(self, X, y=None):
760729 kwargs ['affinity' ] = self .affinity
761730 self .children_ , self .n_components_ , self .n_leaves_ , parents = \
762731 memory .cache (tree_builder )(X , connectivity ,
763- n_components = self .n_components ,
764732 n_clusters = n_clusters ,
765733 ** kwargs )
766734 # Cut the tree
@@ -807,12 +775,6 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):
807775 By default, no caching is done. If a string is given, it is the
808776 path to the caching directory.
809777
810- n_components : int (optional)
811- Number of connected components. If None the number of connected
812- components is estimated from the connectivity matrix.
813- NOTE: This parameter is now directly determined from the connectivity
814- matrix and will be removed in 0.18
815-
816778 compute_full_tree : bool or 'auto', optional, default "auto"
817779 Stop early the construction of the tree at n_clusters. This is
818780 useful to decrease computation time if the number of clusters is
0 commit comments