{"id":39380413,"url":"https://github.com/rcv911/dendrogram","last_synced_at":"2026-01-18T03:00:05.946Z","repository":{"id":209921942,"uuid":"115020032","full_name":"rcv911/dendrogram","owner":"rcv911","description":"How to draw Dendrogram in clustering analysis","archived":false,"fork":false,"pushed_at":"2017-12-23T18:36:43.000Z","size":155,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-11-29T20:43:10.608Z","etag":null,"topics":["cluster","cluster-analysis","clustering","clustering-algorithm","clustering-methods","dendrogram"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcv911.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-21T15:27:03.000Z","updated_at":"2023-11-29T20:43:13.640Z","dependencies_parsed_at":"2023-11-29T20:43:13.560Z","dependency_job_id":"944a6a45-2180-4902-9970-8e469bc55d6c","html_url":"https://github.com/rcv911/dendrogram","commit_stats":null,"previous_names":["rcv911/dendrogram"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/rcv911/dendrogram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcv911%2Fdendrogram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcv911%2Fdendrogram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcv911%2Fdendrogram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcv911%2Fdendrogram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcv911","download_url":"https://codeload.github.com/rcv911/dendrogram/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcv911%2Fdendrogram/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28528025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cluster","cluster-analysis","clustering","clustering-algorithm","clustering-methods","dendrogram"],"created_at":"2026-01-18T03:00:05.597Z","updated_at":"2026-01-18T03:00:05.855Z","avatar_url":"https://github.com/rcv911.png","language":"Python","readme":"# Dendrogram. How to draw.\n\n## Description\n\nIt's one of the clustering methods using [hierarchical clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering).\nWe are going to use [special Scipy library](https://docs.scipy.org/doc/scipy/reference/cluster.hierarchy.html) for Python where you can find\nuseful function for clustering analysis saving your time. \nThis special Scipy library in [GitHub.](https://github.com/scipy/scipy/blob/master/scipy/cluster/hierarchy.py)\n\n\u003eWe are going to use this 2 data from this [project](https://github.com/rcv911/Cluster_generation) but changing some parameters: \n![](images/cluster_test_data0.png)\n![](images/cluster_test_data1.png)\n\n## Algorithm\n\n+ So, we have distance matrix\n```python\n\td = sch.distance.pdist(X) # import scipy.cluster.hierarchy as sch\n```\nor manually (using Euclidean distance)\n```python\n\tfor i in range(N):\n\t\tfor j in range(i+1, N):\n\t\t\td[j, i] = d[i, j] = (sum((X[i, :]-X[j, :])**2))**0.5\n```\n\n\u003e It's important. You can choose any of the metrics in Python function \n[scipy.cluster.hierarchy.distance.pdist()](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.pdist.html)\n\n+ We know the distances between each pair of points. We assume each point is a cluster and we starts to combining them. \n\u003e Important. We combine **only two** of the cluster at each step. **Not the points**. One cluster shifts as a whole to another cluster.\n\n+ 2 stopping criteria:\n  + you achieved critical distance.\n  + you have the right number of clusters\n\n## Results\n\u003e dendrogram for the first test data with 1 cluster\n![](images/cluster_test_dendrogram.png)\n\u003e dendrogram for the second test data with 3 clusters\n![](images/cluster_test_dendrogram1.png)\n\n## Learn more\n\n- [Wiki](https://en.wikipedia.org/wiki/Dendrogram)\n- [Wiki2](https://wiki2.org/en/Dendrogram)\n- [Hierarchical Clustering/Dendrograms](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Hierarchical_Clustering-Dendrograms.pdf)\n\n## Installation\n\nYou can use [Python](https://www.python.org/) with data package: [Anaconda](https://www.anaconda.com/) or [Miniconda](https://conda.io/miniconda).\nThere's another way - use [Portable Python](http://portablepython.com/). Also you can use whatever IDE for Python.\n\n## License\n\nFree","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcv911%2Fdendrogram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcv911%2Fdendrogram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcv911%2Fdendrogram/lists"}