{"id":16386370,"url":"https://github.com/tmcw/k-means","last_synced_at":"2025-03-23T04:31:27.650Z","repository":{"id":4170447,"uuid":"5286199","full_name":"tmcw/k-means","owner":"tmcw","description":"k-means clustering","archived":false,"fork":false,"pushed_at":"2017-04-10T21:08:16.000Z","size":792,"stargazers_count":21,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T01:55:49.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://macwright.org/2012/09/16/k-means.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"overtrue/share.js","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmcw.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":"2012-08-03T14:20:36.000Z","updated_at":"2020-06-10T04:02:22.000Z","dependencies_parsed_at":"2022-08-20T19:21:02.077Z","dependency_job_id":null,"html_url":"https://github.com/tmcw/k-means","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/tmcw%2Fk-means","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fk-means/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fk-means/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmcw%2Fk-means/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmcw","download_url":"https://codeload.github.com/tmcw/k-means/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"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-10-11T04:17:05.721Z","updated_at":"2025-03-23T04:31:27.101Z","avatar_url":"https://github.com/tmcw.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## k-means-cluster\n\n[k-means clustering](http://en.wikipedia.org/wiki/K-means)\nin configurable dimensions, in-browser and with node.js.\n\nIn order to support [learning about the algorithm](http://macwright.org/2012/09/16/k-means.html),\nthis library is split into very small bits, so you can use each\nstep separately.\n\n```javascript\nvar kmeans = require('k-means-cluster');\n\nvar d = [1, 2, 3];\n// take a random sample of the array d\nvar s = kmeans.sample(d, 1);\n\nconsole.log(s);\n// [1]\n\n// Get the euclidean distance between two points represented as\n// arrays\nconsole.log(kmeans.dist([0, 0], [0, 1]), 1);\n// 1\n```\n\nIn order to support a variety of data, accessors are used in functions like\n`means_clusters(x, means, distance, val)` (though with good defaults -\ndistance defaults to euclidean, val defaults to `function(x) { return x; }`).\n\n```javascript\nvar c = kmeans.means_clusters([3], [3, 4])\nconsole.log(c.length);\n// 1\n```\n\n## Usage\n\n    npm install --save k-means-cluster\n\n## Testing\n\n    npm test\n\n## License is [WTFPL](http://sam.zoy.org/wtfpl/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fk-means","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmcw%2Fk-means","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmcw%2Fk-means/lists"}