pm.compareplot gives error "KeyError: 'pwaic'" while creating axis labels
See original GitHub issueDescribe the bug Using recent update by conda I have got an unexpected error from compareplot.
To Reproduce the code
df_comp_WAIC = pm.compare(dict([(model_gamma, trace_gamma),
(model_weibull, trace_weibull),
(model_lognormal, trace_lognormal)]),ic='WAIC')
pm.compareplot(df_comp_WAIC);
shows the plot but gives an error while trying to display the axis labels
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2656 try:
-> 2657 return self._engine.get_loc(key)
2658 except KeyError:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'pwaic'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-123-347d24b0eaad> in <module>
2 (model_weibull, trace_weibull),
3 (model_lognormal, trace_lognormal)]),ic='WAIC')
----> 4 pm.compareplot(df_comp_WAIC);
5 # 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, figsize, textsize, plot_kwargs, ax)
143 if insample_dev:
144 ax.plot(
--> 145 comp_df[information_criterion] - (2 * comp_df["p" + information_criterion]),
146 yticks_pos[::2],
147 color=plot_kwargs.get("color_insample_dev", "k"),
~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
2925 if self.columns.nlevels > 1:
2926 return self._getitem_multilevel(key)
-> 2927 indexer = self.columns.get_loc(key)
2928 if is_integer(indexer):
2929 indexer = [indexer]
~/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2657 return self._engine.get_loc(key)
2658 except KeyError:
-> 2659 return self._engine.get_loc(self._maybe_cast_indexer(key))
2660 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2661 if indexer.ndim > 1 or indexer.size > 1:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'pwaic'
Expected behavior I haven’t had such problem before
Additional context
Running with PyMC3 version v.3.7.rc1
Running with arviz version v.0.3.2
Running with pandas version v.0.24.2
installed by conda (python 3.7.3, macOS)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 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 >KeyError: "['PWR'] not found in axis" - Stack Overflow
Save this question. Show activity on this post. ****I tried different methods and was following the guidance from that notebook, ...
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
@OriolAbril Yes, I checked with ArviZ 0.4.1 today, and it worked smoothly. Thank you again
@OriolAbril Thanks for checking and for your time! I will be waiting for the next update then