Skip to main content

Description

dpcluster is a package for grouping together (clustering) vectors. It automatically chooses the number of clusters that fits the data best. Specifically, it models the data as a Dirichlet Process mixture in the exponential family. For a tutorial see “Dirichlet Process” by Y.W. Teh (2010). Currently the only distribution implemented is the multivariate Gaussian with a Normal-Inverse-Wishart conjugate prior but extensions to other distributions are possible.

Two inference algorithms are implemented:

To install locally run:

python setup.py install --user

Usage

Here is a simple example to demonstrate clustering a number of random points in the plane:

>>> from dpcluster import *
>>> n = 10
>>> data = np.random.normal(size=2*n).reshape(-1,2)
>>> vdp = VDP(GaussianNIW(2))
>>> vdp.batch_learn(vdp.distr.sufficient_stats(data))
>>> plt.scatter(data[:,0],data[:,1])
>>> vdp.plot_clusters(slc=np.array([0,1]))
>>> plt.show()

Running this might produce 2-3 clusters depending on the randomly generated data. The adaptive nature of the Dirichlet Process mixture model becomes apparent when we increase the number of data points from n = 10 to n = 500. In this case the clustering algorithm will likely explain the data using only one cluster.

ToDo

  • Implement more clustering algorithms e.g. based on Gibbs sampling, expectation propagation, stochastic gradient descent.

  • Implement more clustering distributions.

  • Re-implement algorithms to take advantage of multi-core or GPU computing.

Metadata

Release files for dpcluster 0.104

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

Source distribution (sdist)

Source distribution for dpcluster 0.104
File Size Uploaded
dpcluster-0.104.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dpcluster 0.104
File Interpreter ABI Platform
dpcluster-0.104.linux-x86_64.tar.gz Details

Total release size: 49.3 kB

Release files / dpcluster-0.104.tar.gz

Download URL dpcluster-0.104.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b00d3e7b804e0ab6b80d59d3e9c895e0a3339b0144c3e9db955e65b24719cec4
BLAKE2b-256 checksum
How to use checksums
d6c1ef4c1ee0819cf4721adb2bacdfeeca7492e659f3157dfac47721d62a8cc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dpcluster-0.104.linux-x86_64.tar.gz

Download URL dpcluster-0.104.linux-x86_64.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6da1f8579697e35eea48330d6ad6bf2dfae76c016d02d99ae66d3decccb5720c
BLAKE2b-256 checksum
How to use checksums
e7e89b669738b8d722a98ba090b2dee2c74a0622e92068af835069ef21cb7588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.104 This release

2 release files

0.103

2 release files

0.102

2 release files

0.101

2 release files

0.1

2 release files

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