Closed DerWeh closed 2 months ago
Thank you for the great package. Sadly, some of the high level code is written in a way I found quite complicated. I am currently trying to work through the code, trying to understand what's happening. If you are interested, I would offer to refactor some code on the way, as exemplified by this PR.
Please let me know in case you disagree about my suggested changes. Everybody has a different opinion what readable code is.
It might be necessary to extend the tests a little to make sure I didn't accidentally break any edge case, but the PR should not change any functionality. Though the module is sparsely documented, hence I am not certain if I correctly got the intent of the functions.
Your changes seem generally good, and I agree they make the code easier to read. I'll take a closer look tomorrow. As you suspect, some of the utils (especially for merging EBMs) are less well tested than they should be.
Everything other than the minor early return issue looks great! Thanks so much for simplifying this part of the code @DerWeh!!
@paulbkoch I added the special case with a minimal test. Good to merge from my side.
Edit: sorry, messed up committing the test..., now everything should be there.
LGTM. Merging.
And I fixed my bug that didn't handle scenarios where there were no cuts and only 1 interval.
Simplify the utility functions in the EBM utils.