31 #ifndef GRT_KMEANS_HEADER
32 #define GRT_KMEANS_HEADER
34 #include "../../Util/GRTCommon.h"
35 #include "../../CoreModules/Clusterer.h"
36 #include "../../DataStructures/ClassificationData.h"
37 #include "../../DataStructures/UnlabelledData.h"
47 KMeans(
const UINT
numClusters=10,
const UINT minNumEpochs=5,
const UINT maxNumEpochs=1000,
const Float minChange=1.0e-5,
const bool computeTheta=
true);
155 Float getTheta(){
return finalTheta; }
156 bool getModelTrained(){
return trained; }
158 const VectorFloat& getTrainingThetaLog()
const {
return thetaTracker; }
159 const MatrixFloat& getClusters()
const {
return clusters; }
160 const Vector< UINT >& getClassLabelsVector()
const {
return assign; }
161 const Vector< UINT >& getClassCountVector()
const {
return count; }
164 bool setComputeTheta(
const bool computeTheta);
187 inline Float SQR(
const Float a) {
return a*a;};
203 #endif //GRT_KMEANS_HEADER
virtual bool predict(VectorFloat inputVector)
virtual bool saveModelToFile(std::fstream &file) const
KMeans(const UINT numClusters=10, const UINT minNumEpochs=5, const UINT maxNumEpochs=1000, const Float minChange=1.0e-5, const bool computeTheta=true)
virtual bool predict_(VectorFloat &inputVector)
virtual bool predict_(VectorFloat &inputVector)
virtual bool train_(MatrixFloat &data)
virtual bool train(ClassificationData trainingData)
UINT nchg
Number of values changes.
bool setClusters(const MatrixFloat &clusters)
virtual bool loadModelFromFile(std::fstream &file)
UINT numTrainingSamples
Number of training examples.
virtual bool saveModelToFile(std::string filename) const
UINT numClusters
Number of clusters in the model.
virtual bool loadModelFromFile(std::string filename)
bool trainModel(MatrixFloat &data)
virtual bool deepCopyFrom(const Clusterer *clusterer)
virtual bool train_(ClassificationData &trainingData)
KMeans & operator=(const KMeans &rhs)