Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of transition_hyperparameters #25

Merged
merged 14 commits into from
May 31, 2024

Conversation

ThomasColthurst
Copy link

Only on the Distribution side (I.e., not hooked up to hirm.cc yet) and only for BetaBernoulli for now.

@ThomasColthurst ThomasColthurst requested a review from alex-lew May 28, 2024 21:14
Copy link

@alex-lew alex-lew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The math looks good! Left a couple minor questions.

return log_numer - log_denom;
}
double logp_score() const {
double v1 = lbeta(s + alpha, N - s + beta);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our current declaration / implementation of lbeta in util_math.hh and util_math.cc declare the arguments as ints. My compiler issued warnings that floating-point numbers were being coerced. I think now that we have hyperparameters that can be non-integer values, we'll want to change the argument types of lbeta (I think the implementation should stay the same).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

for (double alphat : ALPHA_GRID) {
alpha = alphat;
double lp = logp_score();
if (!std::isnan(lp)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a sense of when nans are showing up?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None in dirichlet_categorical, at least with the current unit test, but I did see them previously in BetaBernoulli's transition_hyperparamters.

Huh. When I rerun that now, I no longer see any Nan's. I wonder if the above lbeta change fixed them.

@ThomasColthurst ThomasColthurst merged commit 9e4f222 into master May 31, 2024
1 of 2 checks passed
@ThomasColthurst ThomasColthurst deleted the 052824-thomaswc-transhypers branch May 31, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants