diff options
| author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-02-25 21:22:27 -0500 | 
|---|---|---|
| committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-02-25 21:22:27 -0500 | 
| commit | 9007216a43c5572c2c343a1700ac79fb35b7d82f (patch) | |
| tree | 10d9ccd68e9bb1ace905fe0ca5eff6f2ef87b5a7 /utils/ccrp_onetable.h | |
| parent | 2faca3e7b3b8e4eba6c036c635a5b23883e72337 (diff) | |
really slow hiero lm
Diffstat (limited to 'utils/ccrp_onetable.h')
| -rw-r--r-- | utils/ccrp_onetable.h | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/utils/ccrp_onetable.h b/utils/ccrp_onetable.h index a868af9a..b63737d1 100644 --- a/utils/ccrp_onetable.h +++ b/utils/ccrp_onetable.h @@ -117,6 +117,18 @@ class CCRP_OneTable {      }    } +  template <typename T> +  T probT(const Dish& dish, const T& p0) const { +    const typename DishMapType::const_iterator it = dish_counts_.find(dish); +    const T r(num_tables_ * discount_ + concentration_); +    if (it == dish_counts_.end()) { +      return r * p0 / T(num_customers_ + concentration_); +    } else { +      return (T(it->second - discount_) + r * p0) / +               T(num_customers_ + concentration_); +    } +  } +    double log_crp_prob() const {      return log_crp_prob(discount_, concentration_);    } | 
