// // KMeans.hpp // // Created by Marc Melikyan on 10/2/20. // #ifndef KMeans_hpp #define KMeans_hpp #include #include namespace MLPP{ class KMeans{ public: KMeans(std::vector> inputSet, int k, std::string init_type = "Default"); std::vector> modelSetTest(std::vector> X); std::vector modelTest(std::vector x); void train(int epoch_num, bool UI = 1); double score(); std::vector silhouette_scores(); private: void Evaluate(); void computeMu(); void centroidInitialization(int k); void kmeansppInitialization(int k); double Cost(); std::vector> inputSet; std::vector> mu; std::vector> r; double euclideanDistance(std::vector A, std::vector B); double accuracy_threshold; int k; std::string init_type; }; } #endif /* KMeans_hpp */