ソースを参照

removed problems after merging

Alexander Freytag 12 年 前
コミット
31fcf1fa1e
1 ファイル変更0 行追加50 行削除
  1. 0 50
      math/cluster/KMedian.cpp

+ 0 - 50
math/cluster/KMedian.cpp

@@ -41,14 +41,8 @@ struct CompareSecond
 // #define DEBUG_KMEDIAN_PROTOCOMP
 
 
-
-<<<<<<< .merge_file_tPxeyL
-KMedian::KMedian(const int & _noClasses, const std::string & _distanceType) :
-  noClasses(_noClasses), distanceType(_distanceType)
-=======
 KMedian::KMedian(const int & _noClusters, const std::string & _distanceType) :
   noClusters(_noClusters), distanceType(_distanceType)
->>>>>>> .merge_file_aM3NwI
 {
   //srand(time(NULL));
   distancefunction = GenericDistanceSelection::selectDistance(distanceType);
@@ -65,11 +59,7 @@ KMedian::KMedian( const NICE::Config *conf, const std::string & _section)
   this->d_minDelta  = conf->gD( _section, "minDelta", 1e-5 );
   this->i_maxIterations = conf->gI( _section, "maxIterations", 200);
   
-<<<<<<< .merge_file_tPxeyL
-  this->noClasses = conf->gI( _section, "noClasses", 20);
-=======
   this->noClusters = conf->gI( _section, "noClusters", 20);
->>>>>>> .merge_file_aM3NwI
 }
 
 KMedian::~KMedian()
@@ -110,21 +100,13 @@ int KMedian::compute_prototypes(const VVector & features, VVector & prototypes,
   #endif
   
   //initialization
-<<<<<<< .merge_file_tPxeyL
-  for (int k = 0; k < noClasses; k++)
-=======
   for (int k = 0; k < noClusters; k++)
->>>>>>> .merge_file_aM3NwI
   {
     prototypes[k].set(0);
     weights[k] = 0;
   }
   
-<<<<<<< .merge_file_tPxeyL
-  NICE::VectorT<int> numberOfCurrentAssignments ( noClasses ) ;
-=======
   NICE::VectorT<int> numberOfCurrentAssignments ( noClusters ) ;
->>>>>>> .merge_file_aM3NwI
   numberOfCurrentAssignments.set ( 0 );
   
   int exCnt = 0;  
@@ -137,20 +119,12 @@ int KMedian::compute_prototypes(const VVector & features, VVector & prototypes,
   }
     
   #ifdef DEBUG_KMEDIAN_PROTOCOMP    
-<<<<<<< .merge_file_tPxeyL
-    std::cerr << "k-median -- current assignmens: " << numberOfCurrentAssignments << std::endl << "noClasses: " << noClasses << std::endl;
-=======
     std::cerr << "k-median -- current assignmens: " << numberOfCurrentAssignments << std::endl << "noClusters: " << noClusters << std::endl;
->>>>>>> .merge_file_aM3NwI
   #endif
   
   //compute the median for every cluster
   #pragma omp parallel for
-<<<<<<< .merge_file_tPxeyL
-  for (int clusterCnt = 0; clusterCnt < noClasses; clusterCnt++)
-=======
   for (int clusterCnt = 0; clusterCnt < noClusters; clusterCnt++)
->>>>>>> .merge_file_aM3NwI
   {    
     NICE::Vector overallDistances ( numberOfCurrentAssignments[ clusterCnt ] );
     VVector::const_iterator lastExampleWorkedOn = features.begin();
@@ -327,11 +301,7 @@ double KMedian::compute_weights(const VVector & features,
                                 std::vector<double> & weights,
                                 std::vector<int> & assignment)
 {
-<<<<<<< .merge_file_tPxeyL
-  for (int k = 0; k < noClasses; k++)
-=======
   for (int k = 0; k < noClusters; k++)
->>>>>>> .merge_file_aM3NwI
     weights[k] = 0;
 
   int j = 0;
@@ -342,11 +312,7 @@ double KMedian::compute_weights(const VVector & features,
     weights[k]++;
   }
 
-<<<<<<< .merge_file_tPxeyL
-  for (int k = 0; k < noClasses; k++)
-=======
   for (int k = 0; k < noClusters; k++)
->>>>>>> .merge_file_aM3NwI
     weights[k] = weights[k] / features.size();
 
   return 0.0;
@@ -362,37 +328,21 @@ void KMedian::cluster(const NICE::VVector & features,
   prototypes.clear();
   weights.clear();
   assignment.clear();
-<<<<<<< .merge_file_tPxeyL
-  weights.resize(noClasses, 0);
-=======
   weights.resize(noClusters, 0);
->>>>>>> .merge_file_aM3NwI
   assignment.resize(features.size(), 0);
 
   int dimension;
 
-<<<<<<< .merge_file_tPxeyL
-  if ((int) features.size() >= noClasses)
-=======
   if ((int) features.size() >= noClusters)
->>>>>>> .merge_file_aM3NwI
     dimension = features[0].size();
   else
   {
     fprintf(stderr,
-<<<<<<< .merge_file_tPxeyL
-        "FATAL ERROR: Not enough feature vectors provided for kMeans\n");
-    exit(-1);
-  }
-
-  for (int k = 0; k < noClasses; k++)
-=======
         "FATAL ERROR: Not enough feature vectors provided for kMedians -- number of Features: %i - number of clusters: %i\n", (int) features.size(), noClusters);
     exit(-1);
   }
 
   for (int k = 0; k < noClusters; k++)
->>>>>>> .merge_file_aM3NwI
   {
     prototypes.push_back( NICE::Vector(dimension) );
     prototypes[k].set(0);