-
Notifications
You must be signed in to change notification settings - Fork 135
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
Dev 114 cmdstan #801
Dev 114 cmdstan #801
Conversation
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.
LGTM.
orbit/estimators/stan_estimator.py
Outdated
training_metrics = {"loglk": loglk} | ||
training_metrics.update( | ||
{"log_posterior": stan_mcmc_fit.get_logposterior(inc_warmup=True)} | ||
) | ||
# log_posterior is not supported in cmdstanpy | ||
# training_metrics.update( | ||
# {"log_posterior": stan_mcmc_fit.get_logposterior(inc_warmup=True)} | ||
# ) | ||
training_metrics.update({"sampling_temperature": sampling_temperature}) |
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.
nit: we can create training_metrics
at once instead of in two steps.
training_metrics = {
"loglk": loglk,
"sampling_temperature": sampling temperature,
}
orbit/estimators/stan_estimator.py
Outdated
training_metrics = dict() | ||
|
||
# extract `log_prob` in addition to defined model params | ||
# this is for the BIC calculation | ||
# loglk is needed for BIC calculation | ||
training_metrics.update({"loglk": stan_extract["loglk"]}) | ||
# FIXME: this needs to be the full length of all parameters instead of the one we sampled? | ||
# FIXME: or it should be not include latent varaibles / derive variables? | ||
# TODO: this needs to be the full length of all parameters instead of the one we sampled? | ||
# TODO: or it should be not include latent variables / derive variables? | ||
training_metrics.update({"num_of_params": len(model_param_names)}) |
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.
nit: same as above. Are there any reasons we're doing this way (i.e., creating a dict in multiple steps)?
amazing! 🚀 ! |
Description
A working branch to propose first solution in using cmdstanpy instead of pystan
Fixes #793
Type of change
PyStan
How Has This Been Tested?
All the original unit tests should be sufficient since this is a change just on the API. One small change is to add
loglk
in the posterior keys in all types of estimators with Stan.