-
Notifications
You must be signed in to change notification settings - Fork 6
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
Equality comparison is incorrect for CategoricalMatrix
#254
Comments
I would not say that it is 'incorrect'. The equality magic method has not been implemented in tabmat. Therefore, CategoricalMatrix, which does not inherit from a class, uses the default, which verifies the identity of the object. In your above example, I am not sure what is the use case for checking equality. Could you please tell us why you want to check this? If you need a fast solution, I would suggest you test for equality using the underlying attribute. In the case of import tabmat
mat1 = tabmat.CategoricalMatrix([1,2,3])
mat2 = tabmat.CategoricalMatrix([1,2,3])
mat1.cat == mat2.cat Similar to |
Thanks for the answer. I think it'd be nice to have the equality comparison return a 1-d boolean array (as opposed to a single value or to a densified 2-d array), as if one had accessed This is useful for example when writing unit tests where this package is used, or when creating new features from these matrix objects. |
I'm not totally convinced that equality comparison should return a 1-d array, even if it gets implemented. For example, the shape of your example matrices is For downstream purposes, would subclassing |
One could also argue that the raw shape is And yes, thanks - for my purposes even just calling |
Comparing one
CategoricalMatrix
against another always yieldsFalse
even if their contents are identical:The text was updated successfully, but these errors were encountered: