Skip to main content

Documentation |

Torchcluster is a python package for cluster analysis. The speed of the clustering algorithm has been effectively improved with the Pytorch backend. We are also working on test datasets and visualization tools. Related work is coming in the next release.

System requirements

torchcluster should work on

  • all Linux distributions no earlier than Ubuntu 16.04

  • macOS X

  • Windows 10

torchcluster also requires Python 3.5 or later. Python 2 support is coming.

Right now, torchcluster works on PyTorch 0.4.1.

Installation

Using pip

pip install torchcluster

Using anaconda

conda install -c tczhangzhi torchcluster

How torchcluster looks like

Define a dataset generator and generate a dataset:

from torchcluster.dataset.simple import SimpleDataset

dataset_factory = SimpleDataset(2, feature=2, sigma=2, device=device)
dataset = dataset_factory(100)

Configuring a clustering algorithm and get your result:

from torchcluster.zoo.spectrum import SpectrumClustering

cluster = SpectrumClustering(2)
result, _ = cluster(dataset)

You can also cluster your own data sets. The dataset should be a tensor of n by m, where n is the number of data points in the dataset and m is the dimension of each data point:

dataset = torch.cat([torch.randn(500,2) + torch.Tensor([-2,-3]), torch.randn(500,2) + torch.Tensor([2,1])])

Use spectral clustering to get the following results:

tensor([0, 0, ..., 1, 1])

License

MIT

Copyright (c) 2019-present, Zhang Zhi

Release files for torchcluster 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torchcluster 0.1.4
File Size Uploaded
torchcluster-0.1.4.tar.gz 4.7 kB Details

Release files / torchcluster-0.1.4.tar.gz

Download URL torchcluster-0.1.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
af97d32e7cb48075e18d3cfc9e5b7e81967b454e51d732441f461d6c10062a24
BLAKE2b-256 checksum
How to use checksums
cc0997acea1de00a69f0dbee4cbaa1661ae9152f385d280465c68b65d28a196f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page