@@ -232,8 +232,9 @@ def k_means(X, n_clusters, init='k-means++', precompute_distances=True,
232
232
233
233
if not k is None :
234
234
n_clusters = k
235
- warnings .warn ("Parameter k was renamed to n_clusters" ,
236
- DeprecationWarning )
235
+ warnings .warn ("Parameter k has been renamed by 'n_clusters'"
236
+ " and will be removed in release 0.14." ,
237
+ DeprecationWarning , stacklevel = 2 )
237
238
238
239
best_inertia = np .infty
239
240
X = as_float_array (X , copy = copy_x )
@@ -740,7 +741,8 @@ def fit(self, X, y=None):
740
741
741
742
if not self .k is None :
742
743
n_clusters = self .k
743
- warnings .warn ("Parameter k was renamed to n_clusters" ,
744
+ warnings .warn ("Parameter k has been renamed by 'n_clusters'"
745
+ " and will be removed in release 0.14." ,
744
746
DeprecationWarning , stacklevel = 2 )
745
747
self .n_clusters = n_clusters
746
748
else :
@@ -1068,6 +1070,11 @@ def fit(self, X, y=None):
1068
1070
Coordinates of the data points to cluster
1069
1071
"""
1070
1072
self .random_state = check_random_state (self .random_state )
1073
+ if self .k is not None :
1074
+ warnings .warn ("Parameter k has been replaced by 'n_clusters'"
1075
+ " and will be removed in release 0.14." ,
1076
+ DeprecationWarning , stacklevel = 2 )
1077
+ self .n_clusters = self .k
1071
1078
X = check_arrays (X , sparse_format = "csr" , copy = False ,
1072
1079
check_ccontiguous = True , dtype = np .float64 )[0 ]
1073
1080
n_samples , n_features = X .shape
0 commit comments