{"id":42357533,"url":"https://github.com/escherba/clustering-metrics","last_synced_at":"2026-01-27T16:36:35.322Z","repository":{"id":66065603,"uuid":"68140265","full_name":"escherba/clustering-metrics","owner":"escherba","description":"Python implementations of various clustering metrics","archived":false,"fork":false,"pushed_at":"2025-10-04T16:55:32.000Z","size":1397,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T18:28:40.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/escherba.png","metadata":{"files":{"readme":"README.rst","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-09-13T19:27:30.000Z","updated_at":"2024-09-19T06:49:30.000Z","dependencies_parsed_at":"2023-05-06T15:17:39.481Z","dependency_job_id":null,"html_url":"https://github.com/escherba/clustering-metrics","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/escherba/clustering-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherba%2Fclustering-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherba%2Fclustering-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherba%2Fclustering-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherba%2Fclustering-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/escherba","download_url":"https://codeload.github.com/escherba/clustering-metrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherba%2Fclustering-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28816563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-27T16:36:35.265Z","updated_at":"2026-01-27T16:36:35.315Z","avatar_url":"https://github.com/escherba.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Clustering Metrics\n==================\n\nA Python implementation of various metrics (primarily external) used for clustering evaluation. The documentation is `available online here \u003chttps://escherba.github.io/clustering-metrics/\u003e`_.\n\nMotivation\n----------\n\nAfter creating an in-memory representation of a clustering or a partition, many common metrics can be calculated\nvery cheaply. The efficiency of the computation depends primarily on the in-memory representation of clustering.\nSparse representations are pefect for this purpose and allow us to calculate many metrics more efficiently than\npackages like Scikit-Learn.\n\nInstallation\n------------\n\nAt the moment, the package is not on PyPI. To install it, use ``pip`` like so:\n\n.. code-block:: bash\n\n   pip install git+https://github.com/escherba/pymaptools#egg=pymaptools-0.2.31\n   pip install git+https://github.com/escherba/clustering-metrics#egg=clustering_metrics-0.0.2\n\nUsage\n-----\n\nClusters can be represented in different ways. One way is to enumerate all items in the cluster with integer labels:\n\n.. code-block:: python\n\n   \u003e\u003e\u003e ground_truth = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2]\n   \u003e\u003e\u003e predicted = [0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 2, 1, 2, 2, 2]\n\nNote that ``ground_truth`` and ``predicted`` must have the same length. We can then produce various metrics\nas follows:\n\n.. code-block:: python\n\n   \u003e\u003e\u003e from clustering_metrics.metrics import ClusteringMetrics\n   \u003e\u003e\u003e cm = ClusteringMetrics.from_labels(ground_truth, predicted)\n   \u003e\u003e\u003e cm.adjusted_rand_index()\n   0.242914979757085\n\n\nAnother way to represent clusters is using partition-style encoding. Here, each clustering is represented\nas a set of partitions:\n\n.. code-block:: python\n\n   \u003e\u003e\u003e ground_truth = [{1, 2, 3, 4}, {5, 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15, 16}]\n   \u003e\u003e\u003e predicted = [{1, 2, 3, 4}, {5, 6, 7, 8, 9, 10, 11, 12}, {13, 14, 15, 16}]\n   \u003e\u003e\u003e cm = ClusteringMetrics.from_partitions(ground_truth, predicted)\n   \u003e\u003e\u003e cm.split_join_distance(normalize=False)\n   4\n\nDevelopment\n-----------\n\nFor development and testing, this package sets up a Python virtualenv under ``./env/``\nrelative to the source tree root.\n\n.. code-block:: bash\n\n   git clone https://github.com/escherba/clustering-metrics.git\n   cd clustering-metrics\n   make test\n\nThe above should finish without interruptions and all tests should pass. To generate documentation:\n\n.. code-block:: bash\n\n   make doc-sources\n   make doc-html\n   make doc-publish\n\nLicense\n-------\n\nThis package is under a BSD 3-clause license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescherba%2Fclustering-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fescherba%2Fclustering-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescherba%2Fclustering-metrics/lists"}