SpectralCluster.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * @file SpectralCluster.h
  3. * @brief spectral clustering by kmeans-clustering of eigenvectors
  4. * @author Erik Rodner
  5. * @date 11/13/2007
  6. */
  7. #ifndef SPECTRALCLUSTERINCLUDE
  8. #define SPECTRALCLUSTERINCLUDE
  9. #include <core/vector/VectorT.h>
  10. #include <core/vector/MatrixT.h>
  11. #include "ClusterAlgorithm.h"
  12. #include "KMeans.h"
  13. namespace OBJREC {
  14. /** spectral clustering by kmeans-clustering of eigenvectors */
  15. class SpectralCluster : public ClusterAlgorithm
  16. {
  17. protected:
  18. int noClusters;
  19. double alpha;
  20. KMeans kmeans;
  21. enum {
  22. L_UNNORMALIZED = 0,
  23. L_RW_NORMALIZED
  24. };
  25. virtual void computeLaplacian ( const NICE::VVector & features,
  26. NICE::Matrix & laplacian,
  27. int method, double alpha );
  28. virtual void getSimilarityMatrix ( const NICE::VVector & features,
  29. NICE::Matrix & laplacian, double alpha );
  30. public:
  31. /** simple constructor */
  32. SpectralCluster (int _noClusters, double alpha);
  33. /**
  34. * @brief standard constructor
  35. * @param conf config file specifying all relevant variable settings
  36. * @param _section name of the section within the configfile where the settings can be found (default: SpectralCluster)
  37. * @date 14-06-2013 (dd-mm-yyyy)
  38. * @author Alexander Freytag
  39. */
  40. SpectralCluster( const NICE::Config *conf, const std::string & _section = "SpectralCluster");
  41. /** simple destructor */
  42. virtual ~SpectralCluster();
  43. void cluster ( const NICE::VVector & features,
  44. NICE::VVector & prototypes,
  45. std::vector<double> & weights,
  46. std::vector<int> & assignment );
  47. };
  48. } // namespace
  49. #endif