summaryrefslogtreecommitdiff
path: root/utils/ccrp_onetable.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-02-25 21:22:27 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2012-02-25 21:22:27 -0500
commite279f1fd267bc18763fa8ff456462c5e677689e9 (patch)
tree866e94ea9cb78c672dee77f0d2161a7ddeb7e5da /utils/ccrp_onetable.h
parentf05aab2a1041b844f411716f2557444bf480f06d (diff)
really slow hiero lm
Diffstat (limited to 'utils/ccrp_onetable.h')
-rw-r--r--utils/ccrp_onetable.h12
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_);
}