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

Extract denominator #118

Closed
wants to merge 17 commits into from
Closed

Extract denominator #118

wants to merge 17 commits into from

Conversation

slobodan-ilic
Copy link
Contributor

@slobodan-ilic slobodan-ilic commented Nov 7, 2018

This PR extracts the duplicated code from proportions and margin, and puts it into a separate internal method. Furthermore, it introduces a clear distinction between the concepts of the denominator, versus that one of the margin. There's potentially more refactoring that can be done after this work.

Note: Needs rebase on #117 (only last 6 commits relevant). Rebased

@coveralls
Copy link

coveralls commented Nov 7, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling fd0a35a on extract-denominator into c1c26cb on master.

Copy link
Contributor Author

@slobodan-ilic slobodan-ilic left a comment

Choose a reason for hiding this comment

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

Rebased, and coverage back to 100%

* Make `margin` part of API instead of being called with __getattr__
* Make all the arguments explicit
* Erradicate revealed bugs in scale means
* Create specialized methods using TDD (unit tests)
* Normalize methods
* Improve docstrings
* Used to be defined as local method in 2 places
* Make it a private static method of the class
* Don't prune univariate MR measures if the denominator is not equal to
  zero. We used to observe only counts (selected) in such cases. The
  correct approach is to observe (selected + non-selected).
* Remove convoluted code from margin method
* Use newly created _denominator method
* Remove xfails
* Put _denominator in the correct alphabetical order
* Add an xfail for the case where proportions are incorrectly pruned
* The pruning needs to be based on unweighted bases, and nothing else
* In this particular case, proportions are Infs, but they're based on
  weighted counts, and don't need to be pruned, because the unweighted
  bases for those proportions are not zero
* Even if weighted margins are 0, don't prune them by default
* Only prune if corresponding unweighted margins are 0
* If margin has more than a single dimension, it might need to be pruned
  in the direction opposite of its calculation (i.e. an MR item might be
  all-missing)
* This represents problems when H&S are inserted (they're not pruned by
  default), and might introduce non-pruned 0 elements in an otherwise
  pruned row/col
@slobodan-ilic slobodan-ilic force-pushed the extract-denominator branch 2 times, most recently from ac73c5f to 25da90d Compare November 28, 2018 16:57
* Move exporter tests to crunch-cube
* Refactor some of the unnecessary logic that was never hit by either
  cube or exporter tests
@slobodan-ilic
Copy link
Contributor Author

Closed in favor of #152

@slobodan-ilic slobodan-ilic deleted the extract-denominator branch May 17, 2019 12:09
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.

None yet

2 participants