error with pymc3.compareplot
See original GitHub issueWhen trying to plot results of model comparison with PyMC3’s pm.compareplot
I get an error…
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-26-a737fed9e2d4> in <module>
----> 1 ax = pm.compareplot(df_comp_WAIC)
/anaconda3/lib/python3.7/site-packages/pymc3/plots/__init__.py in compareplot(*args, **kwargs)
81 else:
82 args[0] = comp_df
---> 83 return az.plot_compare(*args, **kwargs)
84
85 from .posteriorplot import plot_posterior_predictive_glm
/anaconda3/lib/python3.7/site-packages/arviz/plots/compareplot.py in plot_compare(comp_df, insample_dev, plot_standard_error, plot_ic_diff, order_by_rank, figsize, textsize, plot_kwargs, ax)
107
108 if order_by_rank:
--> 109 comp_df.sort_values(by="rank", inplace=True)
110
111 if plot_ic_diff:
/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in sort_values(self, by, axis, ascending, inplace, kind, na_position)
5006
5007 by = by[0]
-> 5008 k = self._get_label_or_level_values(by, axis=axis)
5009
5010 if isinstance(ascending, (tuple, list)):
/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py in _get_label_or_level_values(self, key, axis)
1772 values = self.axes[axis].get_level_values(key)._values
1773 else:
-> 1774 raise KeyError(key)
1775
1776 # Check for duplicates
KeyError: 'rank'
Any empty plot figure is returned, but the expected compare plot figure is not produced.
Am using arviz 0.5.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Pm.compareplot throws error - version agnostic
I was comparing two models with pm.compare and I wanted to visualize the values using pm.compare but I got an error.
Read more >Problems with theano when trying to use pymc3 - Stack Overflow
I was able to replicate the issue in PyMC3. This appears to be something wrong with the SMC sampler when combined with multiprocessing....
Read more >pymc3 - RELEASE-NOTES.md - GitLab
Fixed bug whereby partial traces returns after keyboard interrupt during parallel sampling had fewer draws than would've been available # ...
Read more >Building a Bayesian Logistic Regression with Python and ...
Define logistic regression model using PyMC3 GLM method with multiple independent variables. We assume that the probability of a subscription ...
Read more >Bayesian logistic regression with pymc3 - SROSE
The target variable is given as deposit and takes on a value of 1 if the customer has subscribed and 0 otherwise. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, see my previous comment. Sorry for the inconvenience and glad you are back on track!
The problem I think is that the current stable version of PyMC3 uses arviz by default for the plots but not for other functions, creating potential inconsistencies like the one you reported. This have been solved on PyMC3’s master, and it will be solved for the next release (that hopefully is almost here).
My recommendation is to explicitly use ArviZ functions, and keep the
pm.()
alias just as backward compatible solution.