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 pspartition
.
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 asPyGraph
but different inner implementation. - Version 0.5: expose
run_psp_i
forInfoCluster
. - Version 0.7: change the python binding name from
info_cluster
topspartition
.
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
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for pspartition-0.7.post1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c0b870f46a1a3bf46ddd527a3499d53520b32fad1f8668383d6e8ecbeb78e3b |
|
MD5 | facf6b7b261a1d590a048d57d0068231 |
|
BLAKE2b-256 | 8049e1ad34df11df2a36f2d2280dbb475cb7794851f69dfff17eb0208b75c00d |
Close
Hashes for pspartition-0.7.post1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 342ae2dde1db3eb1c69803f1a1a50d62c7918a4952b957664aa9ae38efa43a91 |
|
MD5 | 9245f7890502bb8ed9d1c122ee9ee8fe |
|
BLAKE2b-256 | 983850fc229f1a51376ca8d7d24e2550057f57ff11cce9613ccdf2237fc8356a |
Close
Hashes for pspartition-0.7.post1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e79531110932f3d54f2d48ad19a2e16805ea385052450fd52e3dc1558240ed |
|
MD5 | 3d6b8de3dc67e686022cfd8e58eff71b |
|
BLAKE2b-256 | 563a83c9524d3323bc621d29c2a43c56031883b0e47475260203837cedb84910 |
Close
Hashes for pspartition-0.7.post1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df68b140fc563b23972207c95348ce816d14d9851ba1a6c6a3597a82c1a69098 |
|
MD5 | cca55206830a0ffffb90d12703f33e4e |
|
BLAKE2b-256 | ae5a577083dfb8805db18bea0fa7422ecd47c54fc1cd37a47145e6036c4bacfb |
Close
Hashes for pspartition-0.7.post1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c94fc4feb9afd72e4844ca0067913ddcba2ec1248d93829641521fc5c8f1815e |
|
MD5 | c59ace4e805d9bad4c911eb186b8b35d |
|
BLAKE2b-256 | 7e5e5d88a0883cd10326a83060a2815beea7aaefaff14035432a6073f1c9ae15 |
Close
Hashes for pspartition-0.7.post1-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0bfe6f228ad27525ad3200fa6d7d72bea1a9822ceb6b08c6dab332484716022 |
|
MD5 | dd2824e270e21d73496038cb20e35746 |
|
BLAKE2b-256 | d938b311d8ac0c40aa28252028c96f09bc1eb16a61c3ab1d095185f5c63a9452 |