void DiscreteFrustum::addExample(double ground_truth, double measurement) { double mult = ground_truth / measurement; if(mult > MAX_MULT || mult < MIN_MULT) return; int idx = min(num_bins_ - 1, (int)floor(measurement / bin_depth_)); UASSERT(idx >= 0); total_numerators_(idx) += ground_truth * ground_truth; total_denominators_(idx) += ground_truth * measurement; ++counts_(idx); multipliers_(idx) = total_numerators_(idx) / total_denominators_(idx); }
void DiscreteFrustum::addExample(double ground_truth, double measurement) { boost::unique_lock<boost::shared_mutex> ul(shared_mutex_); double mult = ground_truth / measurement; if(mult > MAX_MULT || mult < MIN_MULT) return; int idx = min(num_bins_ - 1, (int)floor(measurement / bin_depth_)); assert(idx >= 0); total_numerators_(idx) += ground_truth * ground_truth; total_denominators_(idx) += ground_truth * measurement; ++counts_(idx); multipliers_(idx) = total_numerators_(idx) / total_denominators_(idx); }