Skip to content
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

Densityplot: add support for discrete variables #2878

Merged
merged 3 commits into from
Mar 2, 2018

Conversation

aloctavodia
Copy link
Member

No description provided.

@ColCarroll
Copy link
Member

Can you post a screen shot/example of what this looks like? Maybe also a test (our plotting "tests" are just making sure you can call the functions)?

@aloctavodia
Copy link
Member Author

In this example sigma is continuous and gamma discrete

density_plot

Densityplot is already included in our tests (see #2741)

@aloctavodia
Copy link
Member Author

ups! I just notice a problem (with the xticks)

bins = range(xmin, xmax+1)
if outline:
ax.hist(vec, bins=bins, color=c, histtype='step')
ax.hist(vec, bins=bins, color=c, alpha=shade)
Copy link
Member

Choose a reason for hiding this comment

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

Better to set density=None to True.

Copy link
Member Author

Choose a reason for hiding this comment

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

That will only change the scale of y. But that scale is not plotted, the yticks are set to an empty list.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Fine with me.

@aloctavodia
Copy link
Member Author

This is how it looks like with the fix

density_plot

@@ -64,7 +65,7 @@ def densityplot(trace, models=None, varnames=None, alpha=0.05, point_estimate='m

"""
if point_estimate not in ('mean', 'median', None):
raise ValueError("Point estimate should be 'mean' or 'median'")
raise ValueError("Point Estimate should be 'mean', 'median' or None")
Copy link
Member

Choose a reason for hiding this comment

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

why Estimate?

Copy link
Member Author

Choose a reason for hiding this comment

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

just a typo

@twiecki
Copy link
Member

twiecki commented Mar 2, 2018

This looks great!

@junpenglao junpenglao merged commit be532de into pymc-devs:master Mar 2, 2018
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.

4 participants