Skip to main content

Interactive dendrograms compatible with scipy, scikit-learn and hdbscan

Project description

idendrogram

idendrogram helps you create nicer, interactive visualizations of hierarchical clustering trees (a.k.a. dendrograms) from clustering outputs generated by your preferred hierarchical clustering library (SciPy, Scikit-learn or HDBSCAN) in your preferred python visualization library (Altair, Plotly or Matplotlib)

It also supports bi-directional Streamlit integration via a custom D3-powered component.

Installation

To use the main package:

pip install idendrogram

To use the bi-directional Streamlit component:

pip install idendrogram idendrogram-streamlit-component

Basic usage

import idendrogram
import scipy.cluster.hierarchy as sch
from idendrogram.targets.altair import to_altair

#cluster the data
linkage_matrix = sch.linkage(
    data['data'], method='single', metric='euclidean'
)
threshold = 0.8
flat_clusters = sch.fcluster(
    linkage_matrix, t=threshold, criterion='distance'
)

#wrap clustering outputs / parameters into a container
cl_data = idendrogram.ClusteringData(
    linkage_matrix = linkage_matrix, 
    cluster_assignments = flat_clusters
)

#pass to idendrogram and visualize
idd = idendrogram.idendrogram()
idd.set_cluster_info(cl_data)
dendrogram = idd.create_dendrogram(truncate_mode='level', p=10)
to_altair(dendrogram=dendrogram, height=200, width=629)

For more, see docs at https://kamicollo.github.io/idendrogram/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

idendrogram-0.2.0.tar.gz (12.8 MB view details)

Uploaded Source

Built Distribution

idendrogram-0.2.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file idendrogram-0.2.0.tar.gz.

File metadata

  • Download URL: idendrogram-0.2.0.tar.gz
  • Upload date:
  • Size: 12.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for idendrogram-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fcbd65aae8b80221be8b78b3a2319e1c1d042b53beccb2b863009976220ef6bb
MD5 33d7f4ae3b44187e698c0b0ef66ac392
BLAKE2b-256 56936414404c343f775384800fc2aed814297b795c9690ee7f71b3ad13bdb7c6

See more details on using hashes here.

File details

Details for the file idendrogram-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: idendrogram-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for idendrogram-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c5b9e4326838a83625baef17c49e3551c2810a48cbec8bcff94ee42b97ae32
MD5 a2fde6d885ec2d1426dca65580ff16b4
BLAKE2b-256 061611c55c0cf874966380f96807e3f85219386537fc2c64e2747e494d83384e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page