Skip to content

Comments

Added check_test_point method to Model#2936

Merged
ColCarroll merged 3 commits intomasterfrom
check_test_point
Apr 21, 2018
Merged

Added check_test_point method to Model#2936
ColCarroll merged 3 commits intomasterfrom
check_test_point

Conversation

@fonnesbeck
Copy link
Member

Hopefully this is a useful diagnostic tool. It reports the log-probabilities of all model variables for a given test point (uses self.test_point if none is provided). Should be helpful when sampling fails due to nans.

@junpenglao
Copy link
Member

Related issue: #2509

@fonnesbeck
Copy link
Member Author

I thought about calling it during sample but it can add considerable compute time to what can already be a slow startup process. So, I elected to keep it as a debugging tool.

Copy link
Member

@ColCarroll ColCarroll left a comment

Choose a reason for hiding this comment

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

i really like this - it will simplify debugging a ton.

if test_point is None:
test_point = self.test_point

return Series({RV.name:np.round(RV.logp(self.test_point), round_vals) for RV in self.basic_RVs},
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to round?

Also, what do you think about returning a pd.DataFrame with columns log-probability and test_point?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not think that displaying logps to high precision was helpful, particularly since we are mostly looking for nans.

The DF is a good idea! Let me try and do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess the problem with this is that the test_point for some variables is vector-valued, so it would not comport well to being displayed in a DataFrame cell.

@ColCarroll ColCarroll merged commit 0382330 into master Apr 21, 2018
drastorguev pushed a commit to drastorguev/pymc3 that referenced this pull request Apr 21, 2018
* Added check_test_point function

* Added change to RELEASE-NOTES

* Fixed typo
@junpenglao junpenglao deleted the check_test_point branch April 21, 2018 15:00
ColCarroll pushed a commit that referenced this pull request Apr 21, 2018
* updated 'updating_priors' notebook

* updated 'api_quickstart' notebook

* updated 'AR' notebook

* updated 'Bayes_factor' notebook

* Added check_test_point method to Model (#2936)

* Added check_test_point function

* Added change to RELEASE-NOTES

* Fixed typo

* updated 'runing' typos to 'running' in these 4 notebooks
agustinaarroyuelo pushed a commit to agustinaarroyuelo/pymc3 that referenced this pull request Feb 8, 2019
* Added check_test_point function

* Added change to RELEASE-NOTES

* Fixed typo
agustinaarroyuelo pushed a commit to agustinaarroyuelo/pymc3 that referenced this pull request Feb 8, 2019
* updated 'updating_priors' notebook

* updated 'api_quickstart' notebook

* updated 'AR' notebook

* updated 'Bayes_factor' notebook

* Added check_test_point method to Model (pymc-devs#2936)

* Added check_test_point function

* Added change to RELEASE-NOTES

* Fixed typo

* updated 'runing' typos to 'running' in these 4 notebooks
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.

3 participants