12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /**
- * @file KMeansHeuristic.h
- * @brief K-Means
- * @author Erik Rodner, Michael Koch, Michael Trummer
- * @date 02/04/2011
- */
- #ifndef KMeansHeuristicINCLUDE
- #define KMeansHeuristicINCLUDE
- #include <core/vector/Distance.h>
- #include "ClusterAlgorithm.h"
- #include "core/vector/VectorT.h"
- #include "core/vector/MatrixT.h"
- namespace OBJREC
- {
- /** K-Means */
- class KMeansHeuristic: public ClusterAlgorithm
- {
- protected:
- int noClasses;
- std::string distanceType;
- NICE::VectorDistance<double> *distancefunction;
- double compute_assignments(const NICE::VVector & features,
- const NICE::VVector & prototypes, std::vector<int> & assignment);
- double compute_weights(const NICE::VVector & features,
- std::vector<double> & weights, std::vector<int> & assignment);
- double compute_delta(const NICE::VVector & oldprototypes,
- const NICE::VVector & prototypes);
- void initial_guess(const NICE::VVector & features, NICE::VVector & prototypes);
- void print_iteration(int iterations, NICE::VVector & prototypes, double delta);
- int robust_prototypes(const NICE::VVector &features, NICE::VVector &prototypes, std::vector<
- double> & weights, const std::vector<int> & assignment);
- public:
- /** simple constructor */
- KMeansHeuristic(int noClasses, std::string distanceMode = "euclidean");
- /** simple destructor */
- virtual ~KMeansHeuristic();
- void cluster(const NICE::VVector & features, NICE::VVector & prototypes, std::vector<double> & weights, std::vector<int> & assignment);
- };
- } // namespace
- #endif
|