@@ -284,7 +284,8 @@ def predict(self, data: pd.DataFrame) -> Tuple[np.ndarray, pd.DataFrame]:
284284 Returns
285285 -------
286286 Tuple[np.ndarray, pd.DataFrame]
287- A tuple containing the nearest centroid index for each data point and the nearest centroids.
287+ A tuple containing the nearest centroid index for each data point,
288+ and the nearest centroids.
288289 """
289290
290291 if self .is_fitted is False :
@@ -310,9 +311,11 @@ def fit_predict(
310311 data : pd .DataFrame ,
311312 directional_variables : List [str ] = [],
312313 custom_scale_factor : dict = {},
314+ min_number_of_points : int = None ,
313315 ) -> Tuple [np .ndarray , pd .DataFrame ]:
314316 """
315- Fit the K-Means algorithm to the provided data and predict the nearest centroid for each data point.
317+ Fit the K-Means algorithm to the provided data and predict the nearest centroid
318+ for each data point.
316319
317320 Parameters
318321 ----------
@@ -324,17 +327,22 @@ def fit_predict(
324327 custom_scale_factor : dict
325328 A dictionary specifying custom scale factors for normalization.
326329 Default is {}.
330+ min_number_of_points : int, optional
331+ The minimum number of points to consider a cluster.
332+ Default is None.
327333
328334 Returns
329335 -------
330- Tuple[pd.DataFrame, np.ndarray, pd.DataFrame]
331- A tuple containing the nearest centroid index for each data point, and the nearest centroids.
336+ Tuple[np.ndarray, pd.DataFrame]
337+ A tuple containing the nearest centroid index for each data point,
338+ and the nearest centroids.
332339 """
333340
334341 self .fit (
335342 data = data ,
336343 directional_variables = directional_variables ,
337344 custom_scale_factor = custom_scale_factor ,
345+ min_number_of_points = min_number_of_points ,
338346 )
339347
340348 return self .predict (data = data )
0 commit comments