{"id":28591130,"url":"https://github.com/mojixcoder/kmeans","last_synced_at":"2025-06-11T09:13:17.003Z","repository":{"id":247681384,"uuid":"826551425","full_name":"mojixcoder/kmeans","owner":"mojixcoder","description":"K-means clustering algorithm implementation in Golang.","archived":false,"fork":false,"pushed_at":"2024-07-09T23:50:48.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-20T06:48:06.683Z","etag":null,"topics":["go","golang","kmeans","kmeans-clustering"],"latest_commit_sha":null,"homepage":"","language":"Go","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/mojixcoder.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-09T23:42:52.000Z","updated_at":"2024-07-09T23:51:59.000Z","dependencies_parsed_at":"2024-07-10T03:49:28.098Z","dependency_job_id":null,"html_url":"https://github.com/mojixcoder/kmeans","commit_stats":null,"previous_names":["mojixcoder/kmeans"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojixcoder%2Fkmeans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojixcoder%2Fkmeans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojixcoder%2Fkmeans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojixcoder%2Fkmeans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mojixcoder","download_url":"https://codeload.github.com/mojixcoder/kmeans/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojixcoder%2Fkmeans/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259236399,"owners_count":22826309,"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":["go","golang","kmeans","kmeans-clustering"],"created_at":"2025-06-11T09:13:10.466Z","updated_at":"2025-06-11T09:13:16.996Z","avatar_url":"https://github.com/mojixcoder.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# kmeans\n\nk-means clustering algorithm implementation in Go.\n\n## Usage\nOnly has two functions, `Partition` and `PartitionWithCentroids`.\n\nUse `PartitionWithCentroids` if you want to partition observations with your initial centroids. This can be used if you want to calculate initial centroids with any custom logic.\n\nUse `Partition` if you don't care about the creation of initial centroids and they will be randomly genarated based on observations.\n\n## Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/mojixcoder/kmeans\"\n)\n\n// Implements kmeans.Observation\ntype Location struct {\n\tLng, Lat float64\n}\n\nfunc (l Location) X() float64 {\n\treturn l.Lng\n\n}\n\nfunc (l Location) Y() float64 {\n\treturn l.Lat\n}\n\nfunc main() {\n\tobservations := []kmeans.Observation{\n\t\tLocation{Lng: 1, Lat: 1},\n\t\tLocation{Lng: 1, Lat: 2},\n\t\tLocation{Lng: 2, Lat: 1},\n\t\tLocation{Lng: 2, Lat: 2},\n\n\t\tLocation{Lng: 14, Lat: 14},\n\t\tLocation{Lng: 15, Lat: 14},\n\t\tLocation{Lng: 14, Lat: 15},\n\t\tLocation{Lng: 15, Lat: 15},\n\n\t\tLocation{Lng: -10, Lat: -10},\n\t\tLocation{Lng: -11, Lat: -10},\n\t\tLocation{Lng: -10, Lat: -11},\n\t\tLocation{Lng: -11, Lat: -11},\n\t}\n\n\tmaxIters := 100\n\n\tk := 3\n\n\tclusters, err := kmeans.Partition(observations, maxIters, k)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor _, cluster := range clusters {\n\t\tfmt.Println(cluster)\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojixcoder%2Fkmeans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmojixcoder%2Fkmeans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojixcoder%2Fkmeans/lists"}