Skip to content

Revised LGCP notebook #93

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

Merged
merged 3 commits into from
Apr 4, 2021
Merged

Conversation

ckrapu
Copy link
Contributor

@ckrapu ckrapu commented Apr 2, 2021

This PR updates the log Gaussian Cox process notebook to conform to best practices for documentation as documented in #57 . The following changes were made:

  • The GP model formulation was changed from ExpQuad covariance kernel to Matern52 and the diagonal variance prior was changed from HalfCauchy over the standard deviation to InverseGamma over the variance. This solved an issue with the earlier formulation in which some parameter draws corresponded to nonviable covariance matrices.
  • As a consequence of the above, the code for filtering posterior samples for NaNs is no longer needed and was therefore removed.
  • The usage of np.random.randn was replaced with the rng.standard_normal generator for random numbers.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-04-02T14:36:38Z
----------------------------------------------------------------

I think we can delete setting the global seed here.


@review-notebook-app
Copy link

review-notebook-app bot commented Apr 2, 2021

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-04-02T14:36:38Z
----------------------------------------------------------------

I would use chains=4 instead to indicate we want 4 chains, it will then default to 4 cores unless the cpu has less in which it would use all cores available.


ckrapu commented on 2021-04-03T17:27:44Z
----------------------------------------------------------------

Got it - changed the setting.

@review-notebook-app
Copy link

review-notebook-app bot commented Apr 2, 2021

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-04-02T14:36:39Z
----------------------------------------------------------------

Can we use

spp_trace = pm.sample_posterior_predictive(trace, var_names=["intensity_new"], keep_size=True)
trace.extend(az.from_dict(posterior_predictive=spp_trace, dims={"intensity_new": ["sample"]}))
intensity_samples = trace.posterior_predictive["intensity_new"]

Maybe even exponentiate here when defining intensity_samples?

Using this will allow to subset with intensity_samples.sel(sample=3) and to average with intensity_samples.mean(("chain", "draw")) 


ckrapu commented on 2021-04-03T17:28:19Z
----------------------------------------------------------------

Thanks for the tip! I replaced the subsetting with the relevant Arviz methods.

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-04-02T14:36:39Z
----------------------------------------------------------------

I would leave that you are the author of the notebook, and add to that that you updated it too


@OriolAbril
Copy link
Member

Also note that you have to make sure to run the style checks: https://github.com/pymc-devs/pymc3/wiki/PyMC3-Jupyter-Notebook-Style-Guide

@ckrapu ckrapu force-pushed the update-lgcp-example branch from 419cc71 to b1f16f4 Compare April 2, 2021 17:37
Copy link
Contributor Author

ckrapu commented Apr 3, 2021

Got it - changed the setting.


View entire conversation on ReviewNB

Copy link
Contributor Author

ckrapu commented Apr 3, 2021

Thanks for the tip! I replaced the subsetting with the relevant Arviz methods.


View entire conversation on ReviewNB

@OriolAbril OriolAbril merged commit 1c6a8eb into pymc-devs:main Apr 4, 2021
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