Fixed control flow bugs : three bugs in how the ML pipeline finds and validates its input files - #36
Open
eboyer221 wants to merge 1 commit into
Open
Fixed control flow bugs : three bugs in how the ML pipeline finds and validates its input files#36eboyer221 wants to merge 1 commit into
eboyer221 wants to merge 1 commit into
Conversation
eboyer221
requested review from
AbhirupaGhosh,
amcim,
epbrenner and
jananiravi
August 12, 2026 23:26
This was referenced Aug 12, 2026
Contributor
|
Some naming conventions need to be changed in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three related bugs in run_ML.R:
runMLmodels() used to check "did I find any files to work with?" before doing anything else, and stop with a clear message if not. That check was missing, so running it before any files exist just crashed with a confusing error.
createMLinputList() figures out which files each model should train on. For one specific setup (leave-one-drug-out combined with cross-testing), it correctly built the right list of files but never handed that list back - it kept running and returned a different, wrong list instead, with no error.
There used to be a check that immediately stopped with a clear error if someone asked for leave-one-out (LOO) modeling without also saying whether to group by year or country. That check had been turned off, so this mistake wasn't caught - the code just ran and quietly came back with nothing.
Why it matters
Bug 1 meant a first-time run crashed instead of explaining what went wrong. Bug 2 meant one specific setup silently used the wrong training data. Bug 3 meant a bad setup wasn't caught up front, and just failed quietly later, which is confusing to debug.
Fix, and one wrinkle
Bugs 1 and 2 were simple restores. Bug 3 needed a bit more thought: turning that check back on exactly as it was would have also blocked the setup bug 2 fixes (leave-one-drug-out + cross-testing), since that setup doesn't use year/country grouping at all - it's a different kind of "leave one out." So the check now only applies when someone isn't also cross-testing. It still catches the original mistake, but no longer blocks the leave-one-drug-out case.
Testing
Added tests/testthat/test-run-ml-models.R covering all three:
Full test suite passes (207/207).
Found while reviewing #32. Covers the remaining items from the "pipeline control flow" part of Issue #33 (the runModelingPipelineIntense() item was split into its own PR).