-
Notifications
You must be signed in to change notification settings - Fork 108
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
Numerical stability issues in floating point comparisons (chord directional hamming) #295
Comments
Does this cause an error or violated assumption later on, or do things work out? In other words, should we round solely for the check, or should we round any input to the corresponding metric functions? I feel a little odd rounding user data, though we already sort of do it elsewhere in the library. It feels like it would make more sense to round in |
It depends on the metric. Many of the metrics convert (labeled) intervals to samples at some fixed rate (eg 10Hz), in which case, rounding to the millisecond will not change the results. Some of the metrics (directional hamming) use precise differences rather than sampling, and in this case, there should be negligible difference if we round the results. The places where it could get dicey are in something like onset detection or pitch detection, where the tolerances are already quite small (5ms), and maybe a lower tolerance would be appropriate there (1e-4, for instance). Because it depends on the metric / task, I'm hesitant to recommend rolling the rounding into |
Sorry, in that question I was referring specifically to the check in |
I think it should be for both. |
Because if we don't round it things break? Or for consistency and because it's probably the right thing to do? Or what? |
Yeah, sorry -- if we round the timing to validate it, we should compute on the rounded data because it's been validated. |
Ok, do you think we should only fix this in |
I ran into a funny bug just now, and wanted to get some opinions on whether this should be considered an mir_eval problem or not.
This check in the directional hamming distance function looks for disjoint time intervals by comparing the end of one interval to the start of the next.
This is fine in principle, but I have a few (reference) files which are stored in JSON (jams) format, and for whatever reason, deserializing them messes up the floating point precision just right so that it triggers an error. For example:
On the one hand, this is clearly a data error, and it's reasonable for mir_eval to fail here.
On the other hand, this is not a serious data error, and it's one that we can expect to pop up any time we're dealing with numerical data through text serialization, which is basically every use case of mir_eval.
Given that, what do people think of rounding the time intervals (say to the millisecond level) prior to checking? That is, just add lines to the effect of
before the overlap check. For my money, I see no downside to this, but I'd like to get some opinions before opening a PR.
The text was updated successfully, but these errors were encountered: