a hierachical clustering algorithm based on information theory
Project description
Python binding
How to build
The binding uses Cython.
To package the library, use python setup.py bdist_wheel.
Install the package by pip install --user info_cluster.
Below is the prebuilt binary packages:
| Platform | py3.6 | py3.7 |
|---|---|---|
| Windows | T | T |
| MacOS | T | T |
| Linux | T | T |
Demo code
We provide a high-level wrapper of info-clustering algorithm.
After installing
info_cluster, you can use it as follows:
from info_cluster import InfoCluster
import networkx as nx
g = nx.Graph() # undirected graph
g.add_edge(0, 1, weight=1)
g.add_edge(1, 2, weight=1)
g.add_edge(0, 2, weight=5)
ic = InfoCluster(affinity='precomputed') # use precomputed graph structure
ic.fit(g)
ic.print_hierarchical_tree()
The output is like
/-0
/-|
--| \-2
|
\-1
import pspartition # classify the three data points shown in the above figure
g = pspartion.PsPartition(3, [(0,1,1),(1,2,1),(0,2,5)]) # index started from zero, similarity is 5 for vertex 0 and 2
g.run() # default to use psp_i algorithm to classify them
print(g.get_critical_values()) # [2,5]
print(g.get_partitions()) # get the result which has at least 2 categories, which is [0,1,0]
Parametric Dilworth Truncation(pdt) implementation
To make pdt work, you should apply a patch preflow.patch to preflow.h before building, which belongs to lemon library 1.3.1, see
#625.
ChangeLog
- Version 0.2: expose
PSP(C++) class, which is high customizable in python. - Version 0.3: expose
PyGraphPDT(C++) class, which has similar API asPyGraphbut different inner implementation. - Version 0.5: expose
run_psp_iforInfoCluster`. - Version 0.7: change the python binding name from
info_clustertopspartition.
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 Distributions
Built Distributions
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 pspartition-0.7-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: pspartition-0.7-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 113.8 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfaaff67d58170fd8b0f8f3eca33c851a1d4457960ea2eaee77e40376b8636cd
|
|
| MD5 |
5622b204a9a3aad20e8a153f2a310377
|
|
| BLAKE2b-256 |
54efbba9c7354a41f2c29be46e949b2129dfb281789090778823356ed101a0d5
|
File details
Details for the file pspartition-0.7-cp37-cp37m-manylinux2010_x86_64.whl.
File metadata
- Download URL: pspartition-0.7-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b923a06cb583d086b4aa4c5ef3d61f88c63e8bf2174c08b57d558555a7a25aa
|
|
| MD5 |
f05514c57642b4a8a1ca9f991dad6b27
|
|
| BLAKE2b-256 |
cc02ebf1cea44f58bbc51162dbacb73504ba4726e8e7ee970bf22a0bbc8a1db0
|
File details
Details for the file pspartition-0.7-cp37-cp37m-macosx_10_14_x86_64.whl.
File metadata
- Download URL: pspartition-0.7-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 148.3 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19f0534810d89aa7b52df98c0a631270bf5de2bc1b88a1d36296a9ba71fc0316
|
|
| MD5 |
16811c7a723887fddeb1a4909f6c1e6d
|
|
| BLAKE2b-256 |
c47fadaa3b8285fce70a48448d2fc56d4e5e9cd650fd6337820edb4945e0f8f4
|
File details
Details for the file pspartition-0.7-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: pspartition-0.7-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 113.9 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ae58cdacee086c296ccfd79ebeba68a189cdc85aefbaa8434050043f5eaf3e6
|
|
| MD5 |
00d2a9b1b2bef1c7621bdac5aadeccc7
|
|
| BLAKE2b-256 |
1fdf34ba8c32319aa5a2a59971331ddc0b7d9dc732823daf8ac3bec9ab612e77
|
File details
Details for the file pspartition-0.7-cp36-cp36m-manylinux2010_x86_64.whl.
File metadata
- Download URL: pspartition-0.7-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459004e0b0a02723aff149bd883df9b15c57fa1430de4bce926471b3aa8de842
|
|
| MD5 |
f5167fba6aadb847a994d9308d2d3eb3
|
|
| BLAKE2b-256 |
eba1e2d65d0861b2b9cdae793c5572df93ba92425c2eb069a35e3c5e2791c77f
|
File details
Details for the file pspartition-0.7-cp36-cp36m-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pspartition-0.7-cp36-cp36m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 150.5 kB
- Tags: CPython 3.6m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345899449b14824d4c8262ddb3f2a5505ddaf69a4aa8a4dd584e35b4c46dd98e
|
|
| MD5 |
0a53700b03d065b0ca96988fc399241c
|
|
| BLAKE2b-256 |
a6216426cf5b49cc23d4184ad55a742ce6d4cd548cfc2b5e7d35d0a5120b0904
|