/** * @file SpectralCluster.h * @brief spectral clustering by kmeans-clustering of eigenvectors * @author Erik Rodner, Alexander Freytag * @date 11/13/2007 */ #ifndef SPECTRALCLUSTERINCLUDE #define SPECTRALCLUSTERINCLUDE #include #include #include "ClusterAlgorithm.h" #include "KMeans.h" namespace OBJREC { /** spectral clustering by kmeans-clustering of eigenvectors */ class SpectralCluster : public ClusterAlgorithm { protected: int noClusters; double alpha; KMeans kmeans; enum { L_UNNORMALIZED = 0, L_RW_NORMALIZED }; virtual void computeLaplacian ( const NICE::VVector & features, NICE::Matrix & laplacian, int method, double alpha ); virtual void getSimilarityMatrix ( const NICE::VVector & features, NICE::Matrix & laplacian, double alpha ); public: ///////////////////// ///////////////////// ///////////////////// // CONSTRUCTORS / DESTRUCTORS ///////////////////// ///////////////////// ///////////////////// /** * @brief default constructor * @date 12-02-2014 (dd-mm-yyyy ) * @author Alexander Freytag */ SpectralCluster ( ); /** simple constructor */ SpectralCluster (int _noClusters, double alpha); /** * @brief standard constructor * @param conf config file specifying all relevant variable settings * @param _section name of the section within the configfile where the settings can be found (default: SpectralCluster) * @date 14-06-2013 (dd-mm-yyyy) * @author Alexander Freytag */ SpectralCluster( const NICE::Config *conf, const std::string & _section = "SpectralCluster"); /** simple destructor */ virtual ~SpectralCluster(); /** * @brief Jobs previously performed in the config-version of the constructor, read settings etc. * @author Alexander Freytag * @date 12-02-2014 ( dd-mm-yyyy ) */ void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "SpectralCluster"); ///////////////////// ///////////////////// ///////////////////// // CLUSTERING STUFF ///////////////////// ///////////////////// ////////////////// void cluster ( const NICE::VVector & features, NICE::VVector & prototypes, std::vector & weights, std::vector & assignment ); ///////////////////// INTERFACE PERSISTENT ///////////////////// // interface specific methods for store and restore ///////////////////// INTERFACE PERSISTENT ///////////////////// /** * @brief Load object from external file (stream) * @author Alexander Freytag * @date 12-02-2014 ( dd-mm-yyyy ) */ void restore ( std::istream & is, int format = 0 ); /** * @brief Save object to external file (stream) * @author Alexander Freytag * @date 12-02-2014 ( dd-mm-yyyy ) */ void store ( std::ostream & os, int format = 0 ) const; /** * @brief Clear object * @author Alexander Freytag * @date 12-02-2014 ( dd-mm-yyyy ) */ void clear (); }; } // namespace #endif