//------------------------------------------------------------ double MLB::logp(const ChoiceData & dp)const{ // for right now... assumes all choices are available to everyone // uint n = dp->n_avail(); wsp.resize(nch_); fill_eta(dp, wsp); uint y = dp.value(); double ans = wsp[y] - lse(wsp); return ans; }
Vec & MLB::predict(Ptr<ChoiceData> dp, Vec &ans)const{ fill_eta(*dp, ans); ans = exp(ans-lse(ans)); return ans; }
double PCR::response_prob(uint r, const Vector & Theta, bool logsc)const{ fill_eta(Theta); double lognc = lse(eta_); double ans = eta_[r] - lognc; return logsc ? ans : exp(ans); }