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.3.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for flexcluster-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3076271f0984823f9a333e8e7f9cb6ba08da7250a1cf41942875c0e677edbca2 |
|
MD5 | b01f7d91570fb9f59d1d864fc689014b |
|
BLAKE2b-256 | b90825b0f31ea880630105108168b76dddb0fd5cc0a76934dd87bf49a0dc27c0 |