# 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.
<img src='docs/gallery/custom-radii.png' width=500>
<img src='docs/gallery/streamlit-integration.gif' width=500>
## Installation
To use the main package:
```pip install idendrogram```
To use the bi-directional Streamlit component:
```pip install idendrogram idendrogram-streamlit-component```
## Basic usage
```python
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/
Raw data
{
"_id": null,
"home_page": null,
"name": "idendrogram",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "dendrogram,hierarchical clustering,clustering",
"author": "Aurimas Racas",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/56/93/6414404c343f775384800fc2aed814297b795c9690ee7f71b3ad13bdb7c6/idendrogram-0.2.0.tar.gz",
"platform": null,
"description": "# idendrogram\n\nidendrogram 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)\n\nIt also supports bi-directional Streamlit integration via a custom D3-powered component.\n\n<img src='docs/gallery/custom-radii.png' width=500>\n<img src='docs/gallery/streamlit-integration.gif' width=500>\n\n## Installation\n\nTo use the main package:\n\n```pip install idendrogram```\n\nTo use the bi-directional Streamlit component:\n\n```pip install idendrogram idendrogram-streamlit-component``` \n\n## Basic usage \n\n```python\nimport idendrogram\nimport scipy.cluster.hierarchy as sch\nfrom idendrogram.targets.altair import to_altair\n\n#cluster the data\nlinkage_matrix = sch.linkage(\n data['data'], method='single', metric='euclidean'\n)\nthreshold = 0.8\nflat_clusters = sch.fcluster(\n linkage_matrix, t=threshold, criterion='distance'\n)\n\n#wrap clustering outputs / parameters into a container\ncl_data = idendrogram.ClusteringData(\n linkage_matrix = linkage_matrix, \n cluster_assignments = flat_clusters\n)\n\n#pass to idendrogram and visualize\nidd = idendrogram.idendrogram()\nidd.set_cluster_info(cl_data)\ndendrogram = idd.create_dendrogram(truncate_mode='level', p=10)\nto_altair(dendrogram=dendrogram, height=200, width=629)\n```\n\nFor more, see docs at https://kamicollo.github.io/idendrogram/\n",
"bugtrack_url": null,
"license": null,
"summary": "Interactive dendrograms compatible with scipy, scikit-learn and hdbscan",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://github.com/kamicollo/idendrogram",
"Home": "https://github.com/kamicollo/idendrogram"
},
"split_keywords": [
"dendrogram",
"hierarchical clustering",
"clustering"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "061611c55c0cf874966380f96807e3f85219386537fc2c64e2747e494d83384e",
"md5": "a2fde6d885ec2d1426dca65580ff16b4",
"sha256": "b7c5b9e4326838a83625baef17c49e3551c2810a48cbec8bcff94ee42b97ae32"
},
"downloads": -1,
"filename": "idendrogram-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2fde6d885ec2d1426dca65580ff16b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22878,
"upload_time": "2023-07-29T23:01:57",
"upload_time_iso_8601": "2023-07-29T23:01:57.019314Z",
"url": "https://files.pythonhosted.org/packages/06/16/11c55c0cf874966380f96807e3f85219386537fc2c64e2747e494d83384e/idendrogram-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "56936414404c343f775384800fc2aed814297b795c9690ee7f71b3ad13bdb7c6",
"md5": "33d7f4ae3b44187e698c0b0ef66ac392",
"sha256": "fcbd65aae8b80221be8b78b3a2319e1c1d042b53beccb2b863009976220ef6bb"
},
"downloads": -1,
"filename": "idendrogram-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "33d7f4ae3b44187e698c0b0ef66ac392",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12848190,
"upload_time": "2023-07-29T23:01:58",
"upload_time_iso_8601": "2023-07-29T23:01:58.929314Z",
"url": "https://files.pythonhosted.org/packages/56/93/6414404c343f775384800fc2aed814297b795c9690ee7f71b3ad13bdb7c6/idendrogram-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-29 23:01:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kamicollo",
"github_project": "idendrogram",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "idendrogram"
}