-
Notifications
You must be signed in to change notification settings - Fork 8
Added check that an Interval is an Interval; improved readability #48
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
==========================================
- Coverage 54.26% 54.26% -0.01%
==========================================
Files 59 59
Lines 3293 3319 +26
==========================================
+ Hits 1787 1801 +14
- Misses 1506 1518 +12 ☔ View full report in Codecov by Sentry. |
Actually, except during testing, I don't think we want the check, as it would probably affect performances all over the place? Maybe we should verify this by benchmarking ModalDecisionTrees.jl. |
It's true that in automated (e.g., learning) tasks, the check is not needed and may introduce a little overhead. However, for a general usage outside learning (e.g., wanting to know if a formula is true at a specific interval), this is no longer true, and the user can insert an interval which is, in fact, not an interval (e.g., (x,x), or (x, y) where x>y). Not only, this would be useful for reasoning tasks, as checking that two points x and y form an interval (i.e., x<y) is still required in any case, but I'd prefer this kind of logic to live here (i.e., if I'm calling a constructor for Interval elsewhere, I expect it to fail if I give it two points such that they do not form an interval, and not having to check it myself; even more so if an external user is defining a new method accepting an interval). At the same time, I noticed that checking that x > 0 breaks the |
Still I believe the overhead that this check brings is not justified. As for the empty world; I wish there was a way to avoid using it, but I think we have to keep it. Note that the empty world is never read, it is a placeholder, just to have a non-empty vector in MDTs.jl: [Interval(-1, 0)], instead of []. It could be replaced with any interval in fact. So an easy way to uniform it to your boundary check, is to have it be another interval, like |
I agree that differentiating the two needs might be the right solution. Since as you say in the future we might consider oriented intervals, I suggest having an abstract type I also propose renaming the current Regarding However, since this solution requires more work than expected, I'll leave it open for the moment for whoever wants to approach the task, giving priority to more urgent issues. |
I think I have the solution regarding the x < y check! we could label that check with |
Pull request relative to issue #47, adding a check in the Interval constructor ensuring it is an interval (i.e., x<y), and improving code readability.