-
Notifications
You must be signed in to change notification settings - Fork 89
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
RainForests apply calibration skeleton #1708
RainForests apply calibration skeleton #1708
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1708 +/- ##
==========================================
- Coverage 98.13% 97.98% -0.16%
==========================================
Files 111 112 +1
Lines 10190 10272 +82
==========================================
+ Hits 10000 10065 +65
- Misses 190 207 +17
Continue to review full report at Codecov.
|
I'd suggest adding these packages to environment_b and latest. The current CI error on the conda-forge environment will need the lightgbm import to be moved inside the functions where it is used rather than being at the top of the file. This is similar to other optional packages in IMPROVER. Please also update the dependencies documentation in doc/source/Dependencies.rst
The contents of |
a6b6d4d
to
d2763f6
Compare
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 is a good start on adding the RainForests calibration into IMPROVER. The comments I've made are a bunch of minor items and should be pretty easy to address.
It would be worthwhile getting a second review of this PR as it's adding a new CLI.
improver_tests/calibration/rainforests_calibration/test_ApplyRainForestsCalibration.py
Outdated
Show resolved
Hide resolved
d505faf
to
8a6bf66
Compare
And sorry about this. I wasn't aware of this behaviour on your end (and can appreciate how annoying this would be). I'm relatively a novice when it comes to git, so feedback like this is really useful! |
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.
As discussed - I think the sorted dict needs to be used in place of the unsorted dict. You probably need a unit test to show that you're getting the sorting you desire too.
…tween thresholds and tree_models.
Sorry about this @MoseleyS, I wasn't careful enough on the previous update (I clearly rushed it and was to focused on the error thresholds). I've gone with your suggested change, and updated the unit tests to ensure we get what is expected. |
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.
I'm happy with the functionality now, but now that I understand the code, I can't resist asking for the tests to be parametrized as there is a lot of repetition and overlap. To show you what I mean, I've created a PR to this PR: benowen-bom#1
I hope you don't mind me making so many suggestions! I also hope you agree that the end result is better code! Our working hours don't seem to overlap, so it is taking longer to progress than is normal. I think the end is in sight though. |
Review suggestion for metoppv#1708: streamline unit tests for __init__.
Thanks @MoseleyS for this suggestion. I think this does a fantastic job at removing the repetition in the tests and means that the same unit test is applied for calls to |
@MoseleyS: I really appreciate your input and interest in this work! I think the quality of the code is much better through this process, and it's also been a learning experience for me. So there is no need to apologise with making so many suggestions.
The timeframe to get this done has been longer than I expected, but as you allude to, if time zones overlapped nicely this would have been a couple of days rather than a week. |
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.
I'm happy with this now!
@tjtg: Are you happy with this to merged in? |
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.
I've had another check through after the review changes. I'm happy for this to go ahead and get merged.
* Placeholder for RainForests calibration functionality. * Interface for ApplyRainForestsCalibration process function. * Placeholder for apply_rainforests_calibration. * Fill out apply_rainforests_calibration cli, and add function to load model objects. * Add tree-model packages to improver envs. * Update types in interface. * Remove additions to environment_a.yml. * Move initialise_model_config to ApplyRainForestsCalibration __init__ method. * Update dependencies to include tree-model packages. * Add placeholder for unit tests. * Formatting. * Move fixtures to conftest and add test for missing treelite module. * Minor updates to comments. * Reduce default output realization count to more reasonable size. * Included update to default output-realizations into CLI. * Incorporate review comments: update docstrings, imports and variable naming. * Cast features as CubeList and add comment on nature of error_thresholds in __init__ method. * Update license on added files. * Update handling of model_filenames, and add check for missing lightgbm files prior to initialisation. * Add function to enforce error-threshold is ordered, with tree_models ordered accordingly. * Simplify sorting of error_thresholds and associated tree_models. * Fix use of sorted_model_config_dict, and test expected consistency between thresholds and tree_models. * Moves boolean setting out of try block * Parametrizes tests * Drop mark.skipif and update test to run when treelite dependency missing. Co-authored-by: Stephen Moseley <[email protected]>
This PR adds a skeleton for RainForest
apply_rainforests_calibration
CLI and associated plugin.Future PRs following on from this will add in functionality and tests, however following the review of the CLI interface through this PR the interface is not expected to change in subsequent PRs.
Open questions (@tjtg, I'd be interested in your thoughts):
Additional packages are required RainForest calibration. Which envs should these be added to (currently they have been added to all envs exceptconda-forge.yml
)?Where's the best place to callinitialise_model_config
? Currently being called in the CLI prior to calling process. Other options could be that it is called in the__init__
forApplyRainForestsCalibration
or within the associated process function, however both these options will change the interface for the process function.Still to-do:
initialise_model_config
__init__
.Testing: