/** * @file ClusterOnline.cpp * @brief interface for online clustering * @author Erik Rodner * @date 02/13/2008 */ #include #include #include "vislearning/math/cluster/ClusterOnline.h" using namespace OBJREC; using namespace std; // refactor-nice.pl: check this substitution // old: using namespace ice; using namespace NICE; ClusterOnline::ClusterOnline() { } ClusterOnline::~ClusterOnline() { } void ClusterOnline::init () { clusters.clear(); weights.clear(); } void ClusterOnline::cluster ( const VVector & features, VVector & prototypes, std::vector & _weights, std::vector & assignment ) { init(); assignment.clear(); prototypes.clear(); _weights.clear(); for ( VVector::const_iterator i = features.begin(); i != features.end(); i++ ) { // refactor-nice.pl: check this substitution // old: const Vector & x = *i; const NICE::Vector & x = *i; // calling virtual function ! int nearest_cluster = updateClusters ( x ); assignment.push_back ( nearest_cluster ); } prototypes.insert ( prototypes.begin(), clusters.begin(), clusters.end() ); _weights.insert ( _weights.begin(), weights.begin(), weights.end() ); }