Skip to content

Instantly share code, notes, and snippets.

@samionb
samionb / kmeans_test.cpp
Created April 17, 2023 08:18
KMeans test
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <cassert>
// KMeans function here
int main()
{
#include <vector>
#include <random>
#include <algorithm>
#include <cmath>
#include <limits>
// KMeans function takes a dataset, number of clusters, and maximum number of iterations
// Returns a vector of cluster centers
std::vector<std::vector<float>> KMeans(const std::vector<std::vector<float>>& dataset, int k, int max_iterations)
{