Scalable Implementations of clustering algorithms written in Pytorch for running on the GPU.
Project description
Torchclust: Clustering Algorithms written with Pytorch for running on GPU
Torchclust was developed to solve the issue of having to convert Pytorch Tensors to Numpy arrays and moving them to the CPU from the GPU in order to utilise frameworks such as scikit-learn.
Torchclust features implementations of common clustering algorithms with a scikit-learn feel.
Implemented algorithms
- Centroid-based Clustering
- KMeans
- MeanShift
- Density-based Clustering
- DBSCAN
- Gaussian Mixture Model
- Deep / Learning-based Clustering
- Self-Organising Maps
- Metrics
- Internal
- Silhouette Score
- Interia
- Davies-Bouldin Index
- Calinski-Harabasz Score / Variance Ratio Criterion
- External
- Purity Score
- Rand Index
- Adjusted Rand Index
- Mutual Information
- Normalised Mutual Information
- Internal
Contributing
This is still an ongoing project and contributions from the opensource community are warmly welcomed.
Contributions can be made in various forms:
- Writing docs / Updating README
- Fixings bugs
- More efficient implementations of algorithnms
- Or even implementing more algorithms
Installation
Be sure the GPU version of pytorch is installed if you intend to run the algorithms on GPU.
pip install torchclust
Usage
Kmeans on gaussian blobs
import torch
import matplotlib.pyplot as plt
from torchclust.utils.datasets import make_blobs
from torchclust.centroid import KMeans
x, _ = make_blobs(1000, num_features=2, centers=3)
x = torch.from_numpy(x)
kmeans = KMeans(num_clusters=3)
labels = kmeans.fit_predict(x)
plt.scatter(x[:, 0], x[:, 1], c=labels)
plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchclust-1.0.0.tar.gz.
File metadata
- Download URL: torchclust-1.0.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a70fdf7bc6479b9ea176e090d5dfc5a95157075f80e56ba98f69f418cf8dc599
|
|
| MD5 |
10e6ff27610abe4ad239bb7719255233
|
|
| BLAKE2b-256 |
3b3fc1372599bc8b1edb48a76364112e55312c9c849fcfee3211ba830b7b09bb
|
File details
Details for the file torchclust-1.0.0-py3-none-any.whl.
File metadata
- Download URL: torchclust-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cda1d5d5a6f1dfaf949b2df83cf8a430a1b9bc347c68b6693fe36230a452b924
|
|
| MD5 |
48e0c2f2b43d7469ff146683dfacd086
|
|
| BLAKE2b-256 |
9ee6b4a6b66b9013679dd8f3004d71c2828ae254fd0ba981b45bc99b2ddd7165
|