flexible clustering algorithm that allows user-define dissimilarity an centroid calculation
Project description
flexcluster
flexcluster is a python package that provides a flexible implementation for clustering algorithms based on K-means.
The package provides a generic clustering function that allows customization with callback parameters:
- dissimilarity function - function(datapoint1, datapoint2) : int - function that defines the distance between 2 data points.
- centroid calculation function - function(datapoints : np.array) : datapoint - function that calculates a centroid given an array of datapoints.
centroids, centroid_labels = clustering(
data,
k=3,
dissimilarity_fn=dissimilarity_fn, <---- dissimilarity function
centroid_calc_fn=centroid_calc_fn, <---- centroid calculation function)
centroids => calculated centroids per cluster
centroid_labels => map with a numeric key for each cluster and value is an array of item indexes
Kmeans and kmedoids are also provided in this package as shortcuts to specific cluster configuration.
centroids, centroid_labels = kmeans(data, k=3)
centroids, centroid_labels = kmedoids(data, k=3)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flexcluster-0.0.2.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for flexcluster-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 613515e912cd89585f793e0de29fd7f62f613db00b21a00ddc26742e6b77c9e0 |
|
MD5 | 68ff1db132c0a3280fc01040684891d6 |
|
BLAKE2b-256 | ddadd6f0d57b53f7c3ce3065483d015df3983f8357a86dab72395e2829614d24 |