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

Num den mismatch #159594626 #92

Merged
merged 3 commits into from
Aug 16, 2018
Merged

Conversation

slobodan-ilic
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Aug 8, 2018

Coverage Status

Coverage decreased (-0.4%) to 98.451% when pulling 33e040d on num-den-mismatch-#159594626 into 9c85afa on master.

@@ -147,7 +147,7 @@ def _transform(self, res, include_transforms_for_dims,
i - dim_offset in include_transforms_for_dims)
if dim.type == 'multiple_response':
dim_offset += 1
if not transform or dim.type == 'categorical_array':
if not transform or dim.type in ['categorical_array', 'multiple_response']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

use a tuple instead of a list.

@@ -115,8 +115,9 @@ def _elements(self):
@property
def inserted_hs_indices(self):
'''Returns inserted H&S indices for the dimension.'''
if (self.type == 'categorical_array' or not self.subtotals):
return [] # For CA subvariables, we don't do H&S insertions
item_types = ['categorical_array', 'multiple_response']
Copy link
Collaborator

Choose a reason for hiding this comment

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

use a tuple instead of a list, or better, move this to a constant in a shared module.

result = result[0]
else:
if self.prune:
mask = np.array([slice_.mask for slice_ in result])
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this be an iterator instead of a list comprehension (replace [] with ())

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Says fromiter is only for 1-D. All masks here are 2-D.

axis=1, weighted=self.weighted, prune=self.prune
)
return proportions / margin
result = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

would it be possible to store the result as a numpy array by turning this function into an iterator and then using fromiter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, don't think so, sorry :|

- MR dimension somehow has an insertion (data from production)
- num and den shapes mismatch when calculating proportions
- Added utility for showing compressed pruned nd.arrays
@slobodan-ilic
Copy link
Contributor Author

Addressed all the changes that were possible to address without major refactoring @percious

@crunchbot crunchbot merged commit 33e040d into master Aug 16, 2018
@crunchbot crunchbot deleted the num-den-mismatch-#159594626 branch August 16, 2018 21:06
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

4 participants