-
Notifications
You must be signed in to change notification settings - Fork 2
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
Speed up dev_beta_binom()
by adding a scalar version of the log-likelihood function, a vectorized optimization routine, and memoization.
#69
base: main
Are you sure you want to change the base?
Conversation
nehill197
commented
Aug 12, 2024
- Added a scalar case to the log-likelihood function to improve speed for scalar inputs.
- Add memoization (if package is installed) and data has > 800 rows to gain speed from repeated function calls.
- Use a vectorized optimization function to improve speed of optimization required for deviance calculation.
…on for the beta-binomial distribution
…n scalar log likelihood calculation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the optimize_R code to a .R file in /scripts so that not cluttering up the /R folder
R/log-lik.R
Outdated
# x and size unchanged; memoize it to reduce repeated calls | ||
# when length(x) is large enough to outweigh the overhead required by memoize. | ||
# For length(x) < 800, memoize is slower | ||
# https://poissonconsulting.slack.com/archives/C07FC57Q346/p1723248220478269 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would delete this link as it's public repo and only works for poisson folks. Add info to an issue in extras and link to that if critical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
Going to wait to merge until current CRAN submission is complete. |