cluster_data#
- cluster_data(data, method='kmeans', **sk_cluster_kwargs)#
Cluster data using a specified method.
This is a wrapper function for the sklearn clustering methods. The function will return the sklearn clustering object.
- Parameters:
- dataarray-like or sparse matrix, shape (n_samples, n_features)
The input data to cluster.
- methodstr, optional, default=’kmeans’
The clustering method to use. Available methods are: ‘kmeans’, ‘dbscan’, ‘spectral’, ‘affinity’, ‘meanshift’, ‘birch’, ‘optics’, ‘hdbscan’, ‘agglomerative’, ‘minibatchkmeans’.
- sk_cluster_kwargsdict, optional
Additional keyword arguments to pass to the sklearn clustering method.
- Returns:
- cluster_methodsklearn clustering object
The fitted sklearn clustering object.
- Raises:
- ValueError
If the specified method is not in the list of available methods.
Notes
For information on the clustering methods and their parameters, see https://scikit-learn.org/stable/modules/clustering.html.