{"id":19958256,"url":"https://github.com/lerouxrgd/clj-hclust","last_synced_at":"2025-08-30T15:05:24.534Z","repository":{"id":35245623,"uuid":"39505243","full_name":"lerouxrgd/clj-hclust","owner":"lerouxrgd","description":"A hierarchical clustering and visualisation library for clojure based on core.matrix","archived":false,"fork":false,"pushed_at":"2019-10-10T00:16:42.000Z","size":31,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-30T15:04:02.613Z","etag":null,"topics":["clojure","clustering"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lerouxrgd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-22T12:38:48.000Z","updated_at":"2023-08-27T14:54:10.000Z","dependencies_parsed_at":"2022-09-07T01:51:17.466Z","dependency_job_id":null,"html_url":"https://github.com/lerouxrgd/clj-hclust","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lerouxrgd/clj-hclust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerouxrgd%2Fclj-hclust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerouxrgd%2Fclj-hclust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerouxrgd%2Fclj-hclust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerouxrgd%2Fclj-hclust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lerouxrgd","download_url":"https://codeload.github.com/lerouxrgd/clj-hclust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerouxrgd%2Fclj-hclust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272864641,"owners_count":25006040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"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":["clojure","clustering"],"created_at":"2024-11-13T01:41:39.519Z","updated_at":"2025-08-30T15:05:24.516Z","avatar_url":"https://github.com/lerouxrgd.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-hclust\n\nA [hierarchical clustering][hc] and visualisation library for clojure based on core.matrix.\n\n[![Clojars Project](https://img.shields.io/clojars/v/clj-hclust.svg)](https://clojars.org/clj-hclust)\n\n## Usage\n\nAll clustering results are stored in vectors with the form `[left right distance]`.\nA leaf is simply `[id-self id-self 0]` where `id-self` is its index in the matrix.\n\nHere is a simple example:\n\n```clj\n(require '[clj-hclust.core :as hc]\n         '[clojure.core.matrix :as m])\n\n(def M (m/matrix\n        [[0.00 0.50 2.24 3.35 3.00]\n         [0.50 0.00 2.50 3.61 3.04]\n         [2.24 2.50 0.00 1.12 1.41]\n         [3.35 3.61 1.12 0.00 1.50]\n         [3.00 3.04 1.41 1.50 0.00]]))\n    \n(hc/hclust-lw M :single-link)\n\n;;=\u003e [[[0 0 0] [1 1 0] 0.5] [[[2 2 0] [3 3 0] 1.12] [4 4 0] 1.41] 2.24]\n```\n\nUnder the hood core.matrix is used with `:vectorz` as default implementations. \nYou can use another implementation by adding corresponding dependency to your project file and selecting implementation using `set-current-implementation`.\nNote that the selected implementation must support `emap!` from the core.matrix API.\n\n## Algorithms\n\n### Lance-Williams\n\nThe [Lance–Williams algorithms][lance-williams] are an infinite family of agglomerative [hierarchical clustering][hc] algorithms which are represented by a recursive formula for updating cluster distances at each step (each time a pair of clusters is merged).\n\nThe multimethod `lw-updater` allows for custom implementations of such algorithms.\nAvailable implementations are:\n\n* `:single-link` uses min when merging\n* `:complete-link` uses max when merging\n* `:ward` minimizes the total within-cluster variance when merging \n\n## Visualization\n\n### SVG format\n\nA simple [batik][apache-batik] based `JFrame` visualisation is available (note that it's possible to get just the SVG string):\n\n```clj\n(require '[clj-hclust.batik :as b])\n\n(-\u003e M\n    (hc/hclust-lw :single-link)\n    (hc/hclust-\u003esvg)\n    (b/svg-jframe 600 100))\n```\n\nSVG visualisation parameters can be customized:\n\n```clj\n(-\u003e M\n    (hc/hclust-lw :single-link)\n    (hc/hclust-\u003esvg {:names [\"Rochefort\" \"Milady\" \"Athos\" \"Portos\" \"Aramis\"]\n                     :circle-style {:r 10}\n                     :text-style {:dx 16 :dy 6 :font \"14px sans-serif\"}})\n    (b/svg-jframe 700 150))\n```\n\n### Newick format\n\nA [newick format][newick] visualisation is also available:\n\n```clj\n(-\u003e M\n    (hc/hclust-lw :single-link)\n    (hc/hclust-\u003enewick))\n\n;;=\u003e \"(((0:0,1:0):0.5,((2:0,3:0):1.12,4:0):1.41):2.24);\"\n```\n\n## License\n\nCopyright \u0026copy; Romain Leroux\n\nThis project is licensed under the [Eclipse Public License 1.0][license].\n\n[hc]: https://en.wikipedia.org/wiki/Hierarchical_clustering\n\n[lance-williams]: https://en.wikipedia.org/wiki/Ward%27s_method#Lance.E2.80.93Williams_algorithms\n\n[apache-batik]: https://xmlgraphics.apache.org/batik/\n\n[newick]: https://en.wikipedia.org/wiki/Newick_format\n\n[license]: http://www.eclipse.org/legal/epl-v10.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flerouxrgd%2Fclj-hclust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flerouxrgd%2Fclj-hclust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flerouxrgd%2Fclj-hclust/lists"}