示例#1
0
bool StrongClassifier::decide(const FeatureVector &featureVector) const {
  std::vector<float> features(featureVector.size());
  for (int i=0; i<featureVector.size(); i++) {
    features[i] = featureVector.at(i);
  }

  return decide(features);
}
示例#2
0
/**************************************
 * Fucntion: is_classifier_correct
 * -------------------------------
 * returns true if weak classifier (wc) correctly identified the 
 * feature vector (fv), false otherwise.
 */
bool AdaBooster::is_classifier_correct(WeakClassifier &wc, FeatureVector &fv){
	
	// check if threshold is greater than (or equal to) feature
	bool guess = ( wc.threshold() >= fv.at(wc.dimension()) );

	// if classifier is flipped, negate guess
	guess = wc.isFlipped() ? !guess : guess;

	// find actual value of point
	bool real = ( fv.val() == POS );

	// return if guess and real agree
	return ( real == guess );

}