{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/multi-swap-k-means","title":"Multi-Swap $k$-Means++","arxiv_id":"2309.16384","date":"2023-09-28","proceeding":null,"authors":["Lorenzo Beretta","Vincent Cohen-Addad","Silvio Lattanzi","Nikos Parotsidis"],"abstract":"The $k$-means++ algorithm of Arthur and Vassilvitskii (SODA 2007) is often the practitioners' choice algorithm for optimizing the popular $k$-means clustering objective and is known to give an $O(\\log k)$-approximation in expectation. To obtain higher quality solutions, Lattanzi and Sohler (ICML 2019) proposed augmenting $k$-means++ with $O(k \\log \\log k)$ local search steps obtained through the $k$-means++ sampling distribution to yield a $c$-approximation to the $k$-means clustering problem, where $c$ is a large absolute constant. Here we generalize and extend their local search algorithm by considering larger and more sophisticated local search neighborhoods hence allowing to swap multiple centers at the same time. Our algorithm achieves a $9 + \\varepsilon$ approximation ratio, which is the best possible for local search. Importantly we show that our approach yields substantial practical improvements, we show significant quality improvements over the approach of Lattanzi and Sohler (ICML 2019) on several datasets.","url_abs":"https://arxiv.org/abs/2309.16384v2","url_pdf":"https://arxiv.org/pdf/2309.16384v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"multi-swap-k-means","repo_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":null}],"tasks":[{"task_slug":"clustering","task_name":"Clustering"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2309.16384","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.16384"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp","reach":null}],"summary":{"ran_violates":1,"ran":3,"ran_fixture":1,"unverified":3},"by_repo_kind":{"official":{"samples":8,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":8,"samples":[{"code_sha256_prefix":"f06b863959ac69ae","entry":"cost","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f06b863959ac69ae"}},{"code_sha256_prefix":"d0489ba2ad167bc8","entry":"d2_sample","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d0489ba2ad167bc8"}},{"code_sha256_prefix":"18a537e93e2b80e6","entry":"greedy_msls","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"18a537e93e2b80e6"}},{"code_sha256_prefix":"9cae40afd89e06e5","entry":"greedy_msls_step","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9cae40afd89e06e5"}},{"code_sha256_prefix":"3d4b93cefcbacc26","entry":"greedy_out","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3d4b93cefcbacc26"}},{"code_sha256_prefix":"d6367f496de28e14","entry":"cost","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d6367f496de28e14"}},{"code_sha256_prefix":"b16236d62926c6bc","entry":"d2_sample","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b16236d62926c6bc"}},{"code_sha256_prefix":"6dcc0958c5440056","entry":"lloyd","repo":"lorenzo2beretta/multi-swap-k-means-pp","repo_kind":"official","path":"multi_swap_kmpp.py","file_url":"https://github.com/lorenzo2beretta/multi-swap-k-means-pp/blob/HEAD/multi_swap_kmpp.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6dcc0958c5440056"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}