Dev 114 cmdstan#801
Merged
Merged
Conversation
jeongyoonlee
approved these changes
Jan 13, 2023
Comment on lines
170
to
175
| 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}) |
Collaborator
There was a problem hiding this comment.
nit: we can create training_metrics at once instead of in two steps.
training_metrics = {
"loglk": loglk,
"sampling_temperature": sampling temperature,
}
Comment on lines
260
to
266
| 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)}) |
Collaborator
There was a problem hiding this comment.
nit: same as above. Are there any reasons we're doing this way (i.e., creating a dict in multiple steps)?
Closed
Contributor
|
amazing! 🚀 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A working branch to propose first solution in using cmdstanpy instead of pystan
Fixes #793
Type of change
PyStanHow 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
loglkin the posterior keys in all types of estimators with Stan.