Repository navigation
HPC + MDR optimization & updated defaults - #61
Conversation
Primarily updates HPC performance with Slurm arrays. Now spins out jobs more robustly into very large-scale arrays, and when OOM errors pop up (they will), this logs and auto-retries with additional memory for two more retries. Benchmarking with S. sonnei shows great improvements in runtime when scaled up with large arrays. Also some MDR scoring changes, which aren't final and deserve scrutiny.
Wasn't catching false positives for some MDR classes, bug has been relocated outside and removed from the premises.
Updating CV handling so folds can be distributed to individual CPU cores, which benefits some very very very slow MDR models. Adding verbosity handling, changing what "vanilla" refers to and adding a lot more documentation to help users figure out what different parameters do.
|
There's a lot of useful machinery here (OOM handling and retries, the SLURM runner, MDR label diagnostics), which also means a lot to check. Unlike #53 and #59, this PR changes fitting results, so I tested it on a subset of S. flexneri: 40 tasks from gene features, covering 3 vanilla drugs (binary), 1 drug (counts), binary MDR, the MDR combination model and a 4-target cross-drug group, each with seeds 123 and 456 and real and shuffled labels. Results were I'll support merging once we've made explicit decisions on these points: 1. Penalty-path exclusion (now on by default). Tuning tries 60 candidates, 10 penalties × 6 mixtures ( I checked how much that matters. With fewer genomes than features, glmnet's default path stops at 1/100 of its largest penalty ( Pros:
Cons:
I also tried the obvious alternative: giving glmnet the grid's penalties as its path (
So on this subset the three behaviors make the same predictions but report very different feature lists. Which one we want is the real decision, and since those lists are what MAGIC works from, I think we should make it explicitly. Also worth noting that on more complex bugs, predictions may not necessarily be the same. 2. Rescoring on MDR. The description covers the new It also changes what "shared" means. In #53, Pros:
Cons:
We may want to make this its own PR, so it gets its own review and we can make sure reversing the earlier exclusion is intentional. 3. Merging with #53. I merged #53 into #59 because the conflicts there were simple. The ones here are harder. Merging Question 4. MDR in grouped modes. This removes MDR from every stratified, cross and leave-one-out mode. That reverses |
|
I went through the MDR parts since that's what I worked on originally. Giving MDR its own mode does seem better than having it inside "vanilla", and the per-label diagnostics are really helpful and avoids overall MCC hiding labels the model never gets right. I see MDR is no longer running in the year/country/cross modes - But could you:
Running MAGIC on MDR:
The label bug fix in ad62a92 looks at both the true and predicted labels, but .networkOutcomeLabels() in network.R still only looks at the true ones. Is that on purpose? I haven't run it to check, just noticed it. On the penalty changes - I agree with Alex that we should decide this on purpose, since it changes which features get picked and everything after that uses those lists. |
|
Thanks for the careful review, Alex and Emily! Going to separate a few changes out here. First, the path exclusion leaving Ridge out isn't great and wasn't intended. I'm going to say I/we think about this in more detail and can revert to prior tuning behavior until we finalize it. Same with the MDR feature scoring -- I'm okay with that being its own PR, and doesn't need to be a v1 feature. For MDR not running cross-test models, that is intentional -- Abhirupa and I had a conversation about this last week, and the long and short of it is that so many nested assumptions going into a leave-one-geography-out multiclass MDR model means an extraordinarily complex model (that takes hours to run) but provides fairly limited scientific information. We could allow these to be manually enabled, perhaps, but I don't think they should be a part of a default MDR run. I'll try to clean things up quickly so we can keep it moving. |
Oops. Co-Authored-By: Emily Boyer <130874527+eboyer221@users.noreply.github.com>
Updated version can return for a later PR
Falling back to previous MDR scoring and tuning behavior. These changes deserve greater scrutiny and should be made in a future PR, and these updates are not necessary for v1. Tossing them for now to keep this PR cleaner!
…imization # Conflicts: # R/rescore.R # R/task-chunks.R # R/workflow.R # man/rescoreFeatures.Rd # man/runModelingWorkflow.Rd # tests/testthat/test-workflow-presets.R
|
@epbrenner Things look good here! Thanks for the parallelization work. Once we're on 2.0, it'd be worth revisiting speed for MDR in the grouped modes, and I can look at applying ideas like those in my PR #60 elsewhere for more speedup. Because PR #57 was merged early and threw the stack off, I merged #53 into #59 and then #59 into this branch, resolving the conflicts along the way. Each branch now contains the one below it, so merging this into #59, #59 into #53 and #53 into main should go through without conflicts. Also noting that n_feats_returned now counts distinct features rather than one row per feature per label. That's correct and an improvment |
MDR fits on big bugs can spend hours per individual model. This adds optional parallelism across CV folds for all model families, alongside modeling defaults and correctness fixes. This is intended to be used with MDR or struct models and may not have benefits for most models, so it is disabled by default.
What's new?
Try it out!
Drug and drug-class models
runModelingWorkflow(
orb_dir,
model_types = "vanilla",
threads = 8
)
MDR with parallel CV enabled
runModelingWorkflow(
orb_dir,
model_types = "mdr",
threads = 8,
parallel_cv = TRUE,
verbose = TRUE
)
Use model_types = "complete" for all supported modes.