{"id":22357241,"url":"https://github.com/mdh266/kmeans","last_synced_at":"2026-05-18T02:01:54.336Z","repository":{"id":93022781,"uuid":"488809734","full_name":"mdh266/KMeans","owner":"mdh266","description":"Creating A Scikit-Learn Compatable Clustering Algorithm","archived":false,"fork":false,"pushed_at":"2022-05-26T00:19:39.000Z","size":312,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T13:22:24.237Z","etag":null,"topics":["algorithms","clustering","data-science","machine-learning","machine-learning-algorithms","scikit-learn","unsupervised-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/mdh266.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":"2022-05-05T02:44:14.000Z","updated_at":"2022-06-02T08:29:52.000Z","dependencies_parsed_at":"2023-03-08T11:00:44.633Z","dependency_job_id":null,"html_url":"https://github.com/mdh266/KMeans","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"be2d68448558c1b20f4182d5b2104b60acaf73c2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdh266/KMeans","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FKMeans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FKMeans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FKMeans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FKMeans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdh266","download_url":"https://codeload.github.com/mdh266/KMeans/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdh266%2FKMeans/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001767,"owners_count":26083171,"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-10-09T02:00:07.460Z","response_time":59,"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":["algorithms","clustering","data-science","machine-learning","machine-learning-algorithms","scikit-learn","unsupervised-learning"],"created_at":"2024-12-04T14:13:39.978Z","updated_at":"2025-10-09T16:22:46.473Z","avatar_url":"https://github.com/mdh266.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Writing A Scikit Learn Compatible Clustering Algorithm\n-----------------------\n\n## About\n---------\nIn this post, I will go over how to write a K-means clustering algorithm from scratch using [NumPy](https://numpy.org/). The algorithm will be explained in the next section and while seamingly simple, it can be tricky to implement efficiently! As an added bonus, I will go over how to implement a [Scikit-Learn](https://scikit-learn.org/stable/) compatible clustering algorithm so that we can using Scikit-Learn's framework including [Pipelines](https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html) and [GridSearchCV](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html).\n\n\n## Using The Notebook\n----------\nYou can install the dependencies and access the notebook using \u003ca href=\"https://www.docker.com/\"\u003eDocker\u003c/a\u003e by building the Docker image with the following:\n\n\tdocker build -t kmeans .\n\nFollowed by running the command container:\n\n\tdocker run -ip 8888:8888 -v `pwd`:/home/jovyan -t kmeans\n\nSee \u003ca href=\"https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html\"\u003ehere\u003c/a\u003e for more info. \n\nOtherwise without Docker, make sure to use Python 3.9 and install the libraries listed in \u003ccode\u003erequirements.txt\u003c/code\u003e.  These can be installed with the command,\n\n\tpip install -r requirements.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdh266%2Fkmeans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdh266%2Fkmeans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdh266%2Fkmeans/lists"}