-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
7c68e03
to
378c9b4
Compare
src/cr/cube/crunch_cube.py
Outdated
@@ -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']: |
There was a problem hiding this comment.
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.
src/cr/cube/dimension.py
Outdated
@@ -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'] |
There was a problem hiding this comment.
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.
src/cr/cube/measures/index.py
Outdated
result = result[0] | ||
else: | ||
if self.prune: | ||
mask = np.array([slice_.mask for slice_ in result]) |
There was a problem hiding this comment.
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 ())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
src/cr/cube/measures/index.py
Outdated
axis=1, weighted=self.weighted, prune=self.prune | ||
) | ||
return proportions / margin | ||
result = [] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
378c9b4
to
33e040d
Compare
Addressed all the changes that were possible to address without major refactoring @percious |
No description provided.