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

Traceplot parity #94

Closed
ColCarroll opened this issue May 23, 2018 · 13 comments
Closed

Traceplot parity #94

ColCarroll opened this issue May 23, 2018 · 13 comments
Labels
Feature Request New functionality requests from users

Comments

@ColCarroll
Copy link
Member

Is it intentional to have a different traceplot from pymc3? Each element of an RV with shape > 1 gets a plot in arviz, while they are all the same for pymc3.

Explicitly, with eight schools (I only capture the first few plots from arviz):

J = 8
y = np.array([28,  8, -3,  7, -1,  1, 18, 12])
sigma = np.array([15, 10, 16, 11,  9, 11, 10, 18])

with pm.Model() as hierarchical:
    eta = pm.Normal('eta', 0, 1, shape=J)
    mu = pm.Normal('mu', 0, sd=1e6)
    tau = pm.HalfCauchy('tau', 5)
    theta = pm.Deterministic('theta', mu + tau*eta)
    obs = pm.Normal('obs', theta, sd=sigma, observed=y)
    trace_h = pm.sample(1000)

image

@aloctavodia
Copy link
Contributor

Yes, this is intentional for traceplot and other plots.

@ColCarroll
Copy link
Member Author

Thanks!

@junpenglao
Copy link
Contributor

Is there a plan to add an option to have the old pymc3 style plot?

Otherwise it might be useful to restrict the number of plot traceplot (or any other plots, for that matter) products. I am re-running some old codes and if there is a lot of dimension it will break arviz (since it is flattening the dimensions)

@junpenglao junpenglao reopened this Mar 2, 2019
@junpenglao junpenglao added the Feature Request New functionality requests from users label Mar 2, 2019
@aloctavodia
Copy link
Contributor

Do you mean to limit, by default, the output to a given number of plots?

You can use the variable names and coordinates to, explicitly, reduce the number of plots, do you think this is not enough?

@ColCarroll
Copy link
Member Author

I could imagine doing this at the pymc3 level (you can do fancy things with the axes to "overplot"), so that pm.traceplot looks the same, or adding an option in arviz like (somewhat tongue-in-cheek) style={'modern'|'classic'}, or (more reasonable) style={'facet'|'compact'}.

@ahartikainen
Copy link
Contributor

This is just my opinion/question: How often all the components in one parameter describe the same thing?

What could be the future, is to create a book for all the plots or create interactive visualization where user can select the number of "rows" and "cols" for number of plots and also if parameters are combined or not (even on parameter level; e.g. select only theta).

But book would be cool.

@junpenglao
Copy link
Contributor

Do you mean to limit, by default, the output to a given number of plots?

I think having some default is good - otherwise if you just naively call trace_plot with large number of plot it might hang for a while and eventually output an error.

@ColCarroll
Copy link
Member Author

Rebumping this after it came up in PyMC3: I think there is interest in

  1. Global config limit on the number of axes arviz will create (say, 50?)
  2. A kind={'facet' | 'compact'} option for traceplot. See cell 23 in this notebook for an example that could reasonably call for a 'compact' option.

@michaelosthege
Copy link
Contributor

One difficulty with combined plots (I prefer them in most cases) is the overlay of the chains on the right. Maybe, they should get alpha=1/ndim or so.

@twiecki
Copy link
Contributor

twiecki commented May 23, 2019

Advocating for returning to the pymc3 way by default. It is much worse UX to take forever and then break, rather than displaying a crowded plot which might trigger a user to look at the docs to find that option.

@junpenglao
Copy link
Contributor

Or having an option to do pymc3 type of plot so we can use that style in pymc3.
In general, I think it is better style in Arviz as overlaying lots of plots does not really makes sense, but myself also prefer to lazily just plot everything so I can at least eyeball the obviously wrong quickly.

@twiecki
Copy link
Contributor

twiecki commented May 23, 2019

I would argue that even for arviz it doesn't make sense. Usually if a plot is too crowded it will also be too large to be plotted flattened. One results in a crowded plot the other in a hanging kernel.

@aloctavodia
Copy link
Contributor

This have been solved by #679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New functionality requests from users
Projects
None yet
Development

No branches or pull requests

6 participants