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

Remove testing dependency on http download for radon dataset #1717

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

utkarsh-maheshwari
Copy link
Contributor

@utkarsh-maheshwari utkarsh-maheshwari commented Jun 6, 2021

Description

Modified loo_pit tests to remove dependency on radon dataset. Using modified centered_eight instead.
Closes #1716

Checklist

  • Follows official PR format
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

@codecov
Copy link

codecov bot commented Jun 6, 2021

Codecov Report

Merging #1717 (98453d5) into main (4d9caca) will not change coverage.
The diff coverage is n/a.

❗ Current head 98453d5 differs from pull request most recent head cd99aff. Consider uploading reports for the commit cd99aff to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1717   +/-   ##
=======================================
  Coverage   90.86%   90.86%           
=======================================
  Files         108      108           
  Lines       11821    11821           
=======================================
  Hits        10741    10741           
  Misses       1080     1080           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d9caca...cd99aff. Read the comment docs.

@canyon289
Copy link
Member

This looks fine to me. Im not sure why code coverage is decreasing but testing wise it seems fine. In regards to your other comment I'm not entirely sure what this is testing either but Ive only just glanced at it

@utkarsh-maheshwari
Copy link
Contributor Author

Isn't it safe to merge it?

@OriolAbril
Copy link
Member

The modified test is failing to trigger this else condition: https://app.codecov.io/gh/arviz-devs/arviz/compare/1717/changes#D1L1649. It's nothing to worrying but it should not be difficult to generate synthetic data that ensures this case is tested, I'll try to comment with an option doing this.

@canyon289
Copy link
Member

The modified test is failing to trigger this else condition: https://app.codecov.io/gh/arviz-devs/arviz/compare/1717/changes#D1L1649. It's nothing to worrying but it should not be difficult to generate synthetic data that ensures this case is tested, I'll try to comment with an option doing this.

@utkarsh-maheshwari if you able to can you see if you can trigger this else case, perhaps with a parameterized test, or a separate test? After that we should be good to for a merge. I know I'm asking for extra work but it certainly will be much appreciated

@OriolAbril
Copy link
Member

This test checked two things: 1) that loo pit works in all possible cases and that it always returns values between 0 and 1 and 2) that loo_pit works when there are multiple likelihood variables present. The "works in all cases" roughly means having observed data (y) in multiple quantiles of the posterior predictive (y') samples and having both y>y'_i and y<y'_i for all i. The multiple likelihoods test translates into having two variables in log_likelihood group, the decoy filled with zeros is great.

Here is one approach for a synthetic dataset that does all this:

rng = np.random.default_rng(0)
pp = rng.standard_normal(size=(4, 100, 10))
qs = np.quantile(pp, np.linspace(0, 1, 10))
obs = qs[np.arange(10), np.arange(10)]
obs[0] *= .9
obs[-1] *= 1.1
idata = az.from_dict(
    posterior_predictive={"y": pp},
    observed_data={"y": obs},
    log_likelihood={"y": -pp**2, "decoy": np.zeros_like(pp)}
)
loo_pit_data = loo_pit(idata, y="y")
assert np.all((loo_pit_data >= 0) & (loo_pit_data <= 1))

@utkarsh-maheshwari
Copy link
Contributor Author

idata = az.from_dict(
posterior_predictive={"y": pp},
observed_data={"y": obs},
log_likelihood={"y": -pp**2, "decoy": np.zeros_like(pp)}
)

@OriolAbril I guess loo_pit need the posterior as well?

posterior = convert_to_dataset(idata, group="posterior")

@OriolAbril
Copy link
Member

Oh yes, it should have some random samples.

@utkarsh-maheshwari
Copy link
Contributor Author

@canyon289 I can take this. This PR solves other issues as well.!

@utkarsh-maheshwari
Copy link
Contributor Author

Thanks for helping with the dataset 😄 . @OriolAbril

@utkarsh-maheshwari
Copy link
Contributor Author

I did'nt mentioned the changes in changelog. Thought of doing it after seeing all green

@OriolAbril
Copy link
Member

Feel free to add them to the changelog in one of your other open PRs

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.

Remove testing dependency on http download for radon dataset
3 participants