123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- /**
- * @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 <core/vector/VectorT.h>
- #include <core/vector/MatrixT.h>
- #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<double> & weights,
- std::vector<int> & 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
|