Skip to content

fixes docstring and error statement in compare function #267

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

Conversation

The-Broken-Keyboard
Copy link
Contributor

@The-Broken-Keyboard The-Broken-Keyboard commented May 25, 2025

In plot_compare, the docstring and error statement says to use arviz's compare function. While the function is compatible to compare function in arviz-stats. So, fixed those docstrings and error statements. So that it doesn't create any confusion.

@codecov-commenter
Copy link

codecov-commenter commented May 25, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.04%. Comparing base (b5fd816) to head (a788e76).

Files with missing lines Patch % Lines
src/arviz_plots/plots/compare_plot.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #267   +/-   ##
=======================================
  Coverage   73.04%   73.04%           
=======================================
  Files          43       43           
  Lines        5019     5019           
=======================================
  Hits         3666     3666           
  Misses       1353     1353           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@The-Broken-Keyboard The-Broken-Keyboard changed the title fixes column name from elpd to elpd_loo in cmp_df dataframe fixes column name from elpd to elpd_loo or elpd_waic in cmp_df dataframe May 25, 2025
column_index = [c.lower() for c in cmp_df.columns]
if "elpd_loo" not in column_index:

elpd_method = "elpd" + "_" + rcParams["stats.information_criterion"].lower()
Copy link
Contributor

Choose a reason for hiding this comment

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

We are dropping support for waic. We are only going to support loo.

@aloctavodia
Copy link
Contributor

This works

import arviz_base as azb
import arviz_stats as azs
import arviz_plots as azp
model_compare = azs.compare({'Centered': azb.load_arviz_data('centered_eight'),
'Non-centered': azb.load_arviz_data('non_centered_eight')})

azp.plot_compare(model_compare)

@The-Broken-Keyboard
Copy link
Contributor Author

The-Broken-Keyboard commented May 26, 2025

@aloctavodia okay got it, so we have to get data_frame from arviz-stats instead of arviz.

I got confused because it says ValueError: cmp_df must have been created using the compare function from ArviZ. When I checked arviz's compare function then saw that it returns dataframes with columns elpd_loo or elpd_waic .

@The-Broken-Keyboard The-Broken-Keyboard changed the title fixes column name from elpd to elpd_loo or elpd_waic in cmp_df dataframe fixes docstring and error statement in compare function May 26, 2025
@The-Broken-Keyboard
Copy link
Contributor Author

I have updated the docstring and error statement. So that users will know that they have to use compare function from arviz-stats instead of arviz

@aloctavodia
Copy link
Contributor

Thanks, eventually, legacy and new versions of arviz will converge. But in the meantime, that they both exist in parallel can be confusing, so thanks for making things clear.

@aloctavodia aloctavodia merged commit eb5fd2f into arviz-devs:main May 26, 2025
3 checks passed
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.

3 participants