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, <--------------------------------- array of elements
k=3, <---------------------------------- number of clusters
dissimilarity_fn=dissimilarity_fn, <---- dissimilarity function
centroid_calc_fn=centroid_calc_fn, <---- centroid calculation function
max_tries=5) <-------------------------- number of clustering tries (get best result)
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.4.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file flexcluster-0.0.4.tar.gz
.
File metadata
- Download URL: flexcluster-0.0.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a01f2160a65edcb859c724a84b5664e5b0aff6e7ef9b080f7878e1bd8613c2a2 |
|
MD5 | b3f1e9f28205e2e6e6bfd64a60b01cac |
|
BLAKE2b-256 | eb050888c45e2aacb589ec3d3d7b2bd7be514b83e9ea42ea2e9e3a9a1cd78d58 |
File details
Details for the file flexcluster-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: flexcluster-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d8e8fd23dc844d30998f28704e14e908a7e1d0447745acac2e3633ad2a404eb |
|
MD5 | 267ceaa5b1358f5eaccc209de35d4a65 |
|
BLAKE2b-256 | 9c3d6ff268f9598942b7078fe7e1aeb1d51ae17535c89914bdd9a73d30d1d456 |