-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
DiscreteVariable: Raise an exception if values are not unique #6878
Conversation
This bug catcher is so good that it successfully reported 2 bugs on the first attempt. |
548af76
to
12367d4
Compare
12367d4
to
7096908
Compare
7096908
to
dc7b9b2
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6878 +/- ##
==========================================
- Coverage 88.40% 88.38% -0.02%
==========================================
Files 326 329 +3
Lines 71946 72468 +522
==========================================
+ Hits 63605 64053 +448
- Misses 8341 8415 +74 |
I'm so proud of my dilligent work. :) However, as I unintentionally wrote "This does not solve any bugs, but reports them earlier.". :)
|
Orange/preprocess/discretize.py
Outdated
int(-np.log10(mindiff))) | ||
maxdigits = np.finfo(npoints.dtype).precision + 2 | ||
for digits in range(mindigits, maxdigits + 1): | ||
npoints = np.round(points, digits) |
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.
This assumes that np.round and floating point formatter do the same thing. They probably do, but why did you not rather make strings directly and count these?
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.
Actually, see https://numpy.org/doc/2.0/reference/generated/numpy.round.html, they are not the same. :)
Ok, I found some nitpicky issues. I can fix it myself if you agree with my suggestions. |
e22119d
to
d18e026
Compare
I replaced I could not make a test case up where the old implementation would have actual problems, for example, |
d18e026
to
a410361
Compare
The difference between Python's and numpy's rounding.
|
Issue
Closes #6877.
Description of changes
Check that all values are unique; raise an exception if not.
This does not solve any bugs, but reports them earlier.
Includes