{"id":20620571,"url":"https://github.com/blacklight/fkmeans","last_synced_at":"2025-04-15T12:13:59.816Z","repository":{"id":1189061,"uuid":"1092365","full_name":"blacklight/fkmeans","owner":"blacklight","description":"A tiny library in C for managing kmeans clusterization algorithm over arbitrary data sets, both by manually specifying the number k of clusters and computing it automatically using Schwarz criterion","archived":false,"fork":false,"pushed_at":"2010-11-19T11:20:53.000Z","size":120,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T12:13:41.980Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/blacklight.png","metadata":{"files":{"readme":"README","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}},"created_at":"2010-11-18T18:11:24.000Z","updated_at":"2024-08-24T22:52:30.000Z","dependencies_parsed_at":"2022-08-16T12:30:53.000Z","dependency_job_id":null,"html_url":"https://github.com/blacklight/fkmeans","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/blacklight%2Ffkmeans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacklight%2Ffkmeans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacklight%2Ffkmeans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacklight%2Ffkmeans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blacklight","download_url":"https://codeload.github.com/blacklight/fkmeans/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249067779,"owners_count":21207396,"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-16T12:14:53.414Z","updated_at":"2025-04-15T12:13:59.798Z","avatar_url":"https://github.com/blacklight.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"fkmeans is a tiny C library that allows you to perform k-means clustering\nalgorithm over arbitrary sets of n-dimensional data. All you need to do is:\n\n- Include the file kmeans.h in your sources;\n\n- Consider your data set as a vector of vectors of double items (double**),\n  where each vector is an n-dimensional item of your data set;\n\n- If you want to perform the k-means algorithm over your data and you already\n  know the number k of clusters there contained, or its estimate, you want to\n  execute some code like this (in this example, the data set is 3-dimensional,\n  i.e. it contains N vectors whose size is 3, and we know it contains n_clus\n  clusters):\n\n    kmeans_t *km;\n    double **dataset;\n    ...\n    km = kmeans_new ( dataset, N, 3, n_clus );\n    kmeans ( km );\n    ...\n    kmeans_free ( km );\n\n  If you don't already know the number of clusters contained in your data set,\n  you can use the function kmeans_auto() for automatically attempting to find\n  the best one using Schwarz's criterion. Be careful, this operation can be very\n  slow, especially if executed on data set having many elements. The example\n  above would simply become something like:\n\n    kmeans_t *km;\n    double **dataset;\n    ...\n    km = kmeans_auto ( dataset, N, 3 );\n    ...\n    kmeans_free ( km );\n\n- Once the clustering has been performed, the clusters of data can be simply\n  accessed from your kmeans_t* structure, as they are held as a double*** field\n  named \"clusters\". Each vector in this structure represents a cluter, whose\n  size is specified in the field cluster_sizes[i] of the structure. Each cluster\n  contains the items that form it, each of it is an n-dimensional vector. The\n  number of clusters is specified in the field \"k\" of the structure, the\n  number of dimensions of each element is specified in the field \"dataset_dim\"\n  and the number of elements in the originary data set is specified in the field\n  \"dataset_size\". So, for example:\n\n    for ( i=0; i \u003c km-\u003ek; i++ )\n    {\n\t    printf ( \"cluster %d: [ \", i );\n\n\t    for ( j=0; j \u003c km-\u003ecluster_sizes[i]; j++ )\n\t    {\n\t\t    printf ( \"(\" );\n\n\t\t    for ( k=0; k \u003c km-\u003edataset_size; k++ )\n\t\t    {\n\t\t\t    printf ( \"%f, \", km-\u003eclusters[i][j][k] );\n\t\t    }\n\n\t\t    printf ( \"), \");\n\t\t}\n\n\t    printf ( \"]\\n\" );\n\t}\n\n  The library however already comes with a sample implementation, contained in\n  \"test.c\", and typing \"make\" this example will be built. This example takes 0,\n  1, 2 or 3 command-line arguments, in format\n\n  $ ./kmeans-test [num_elements] [min_value] [max_value]\n\n  and randomly generates a 2-dimensional data set containing num_elements, whose\n  coordinates are between min_value and max_value. The clustering is then\n  performed and the results are shown on stdout, with the clusters coloured in\n  different ways;\n\n- After you write your source, remember to include the file \"kmeans.c\",\n  containing the implementation of the library, in the list of your sources\n  files;\n\n- That's all. Include \"kmeans.h\", write your code using\n  kmeans_new()+kmeans()+kmeans_free() or kmeans_auto()+kmeans_free(), explore\n  your clusters, remember to include \"kmeans.c\" in the list of your source\n  files, and you're ready for k-means clustering.\n\nAuthor: Fabio \"BlackLight\" Manganiello,\n        \u003cblacklight@autistici.org\u003e,\n        http://0x00.ath.cx\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacklight%2Ffkmeans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblacklight%2Ffkmeans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacklight%2Ffkmeans/lists"}