{"id":19382844,"url":"https://github.com/locuslab/sdp_clustering","last_synced_at":"2025-04-23T20:32:29.957Z","repository":{"id":57465016,"uuid":"306426928","full_name":"locuslab/sdp_clustering","owner":"locuslab","description":null,"archived":false,"fork":false,"pushed_at":"2020-12-11T20:26:16.000Z","size":217,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-12T05:19:01.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locuslab.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":"2020-10-22T18:32:23.000Z","updated_at":"2024-09-24T08:15:00.000Z","dependencies_parsed_at":"2022-08-31T03:12:02.226Z","dependency_job_id":null,"html_url":"https://github.com/locuslab/sdp_clustering","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fsdp_clustering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fsdp_clustering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fsdp_clustering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Fsdp_clustering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locuslab","download_url":"https://codeload.github.com/locuslab/sdp_clustering/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250509865,"owners_count":21442513,"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","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":"2024-11-10T09:23:31.018Z","updated_at":"2025-04-23T20:32:29.464Z","avatar_url":"https://github.com/locuslab.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDP Clustering • [![PyPi][pypi-image]][pypi] [![colab][colab-image]][colab] [![License][license-image]][license] \n\n[license-image]: https://img.shields.io/badge/License-MIT-yellow.svg\n[license]: LICENSE\n\n[pypi-image]: https://img.shields.io/pypi/v/sdp-clustering.svg\n[pypi]: https://pypi.python.org/pypi/sdp-clustering\n\n[colab-image]: https://colab.research.google.com/assets/colab-badge.svg\n[colab]: https://colab.research.google.com/drive/16d06iAViZHJ58S-RmwAzKR_TyWi5FE-V#offline=true\u0026sandboxMode=true\n\n* Community detection using fast low-cardinality semidefinite programming *\n\nThis repository contains the source code to reproduce the experiments in the NeurIPS'20 paper [Community detection using fast low-cardinality semidefinite programming](https://arxiv.org/abs/2012.02676) by [Po-Wei Wang](https://powei.tw/) and [J. Zico Kolter](http://zicokolter.com/).\n\n## What the package provides\nIt detect communities (that is, clustering with unknown number of clusters) via maximizing a metric called modularity.\nFurther, it provides sparse embeddings for nodes in a graph.\n\n#### How it works\nWe relax the (combinatorial) modularity maximization problem to a smooth semidefinite program (SDP) by converting the Kronecker delta into a dot-product.\nBy further controlling the cardinality (sparsity) in the dot-product space, \nwe develop a efficient optimization algorithm that scales linearly with the number of data entries. See the paper for more details.\n![Conversion](images/locale.png)\n\n## Installation\n\n### Via pip\n```bash\npip install sdp-clustering\n```\n\n### From source\n```bash\ngit clone --recursive https://github.com/locuslab/sdp_clustering\ncd sdp_clustering \u0026\u0026 python setup.py install\n```\n\n#### Package Dependencies\n```\nconda install -c numpy scipy\n```\n\n## Running experiments\nAfter installation, the package provides a command-line utility **locale_alg** accepting matrix-market format.\nFor example, to detect communities in Zachary Karate Club and output the result in *labels.txt*, run\n```bash\nlocale_alg data/zachary.mtx --out labels.txt\n```\nTo obtain the low-cardinality embedding (without rounding) with cardinality ≤2, run\n```bash\nlocale_alg data/zachary.mtx --out emb.txt --embedding --k=2\n```\n\n### Experiment parameters\nAll experiments can be replicated by the default parameters (k=8), except that the Amazon data requires k=16.\n\n## API\nSee **bin/locale_alg** for the example usage.\nMainly, the package provides 3 functions\n```python\nlocale_embedding: obtain embeddings from the continuous optimization algorithm \nleiden_locale:    obtain comminity assignments by the hierarchical Leiden-Locale algorithm\ninit_random_seed: set random seed\n```\nFor more details, see *sdp_clustering/models.py*.\nFor even more details, see the Cpp implementation in the *src/* folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Fsdp_clustering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocuslab%2Fsdp_clustering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Fsdp_clustering/lists"}