feat(DIPK): make the gene list a hyperparameter - #469
Open
jfrog64 wants to merge 1 commit into
Open
Conversation
DIPK hard-coded gene_list="gene_expression_intersection" in load_cell_line_features, so the gene space could only be changed by editing the model. It is now a class attribute with that same value as default and can be overridden with the "gene_list" hyperparameter, mirroring how the single-view sklearn models handle it. build_model stores it on the instance and it stays in self.hyperparameters, so save()/load() carry it over and predict() sees the gene space the model was trained on. Passing None loads all genes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #469 +/- ##
===============================================
+ Coverage 80.34% 82.11% +1.77%
===============================================
Files 101 121 +20
Lines 8171 9841 +1670
===============================================
+ Hits 6565 8081 +1516
- Misses 1606 1760 +154 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
PR Checklist for all PRs
docsis updated — not needed,drevalpy.models.DIPK.dipkis already anautomoduleand the new hyperparameter is documented in thebuild_modeldocstringChanges
Bug fixes
New features
DIPKModel.load_cell_line_featureshard-codes the gene list:so the only way to run DIPK on a different gene space is to edit the model or to subclass it and copy the
whole loader. We ended up with several near-identical DIPK subclasses that differ in exactly that one string,
which is what prompted this.
gene_listbecomes a class attribute whose default is that same"gene_expression_intersection", andbuild_modelpicks it up from the hyperparameters:This mirrors what the single-view sklearn models do (see #464), so both places behave the same way.
Noneloads all genes. Nothing changes for existing runs: without the hyperparameter the model loadsexactly the genes it loaded before, and
hyperparameters.yamlis untouched, so the tuning grid does not grow.The value stays in
self.hyperparameters, which matters for DIPK specifically:save()dumps that dict tohyperparameters.jsonandload()feeds it back intobuild_model, so a restored model predicts on the samegene space it was trained on.
Tests:
tests/test_dipk_gene_list.pybuild_modelbionic_featuresview is unaffected by the gene listgene_listhyperparameter reaches the loader, stays inself.hyperparameters, and does not modify theclass default
gene_list=Noneloads the full matrixbuild_model) restores the gene spaceThe fixture builds a small data directory including
DIPK_features/gene_list_sel.txtandhuman_ppi_features.tsv, so the bionic branch of the loader is exercised for real rather than mocked.PharmaFormer and DrugGNN hard-code their gene list in the same way; those are follow-up PRs with the same
pattern, kept separate so this one stays small.
Maintenance