-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(l2g): better l2g training, evaluation, and integration #576
Merged
Conversation
This file contains 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
project-defiant
approved these changes
Jun 24, 2024
project-defiant
pushed a commit
that referenced
this pull request
Jul 12, 2024
* chore: checkpoint * chore: checkpoint * chore: deprecate spark evaluator * chore: checkpoint * chore: resolve conflicts with dev * chore: resolve conflicts with dev * chore(model): add parameters class property * feat: add module to export model to hub * refactor: make model agnostic of features list * chore: add wandb to gitignore * feat: download model from hub * chore(model): adapt predict method * feat(trainer): add hyperparameter tuning * chore: deprecate trainer tests * refactor: modularise step * feat: download model from hub by default * fix: convert omegaconfig defaults to python objects * fix: write serialised model to disk and then upload to gcs * fix(matrix): drop goldStandardSet when in predict mode * chore: pass token to access private model * chore: pass token to access private model * fix: pass right schema * chore: pre-commit auto fixes [...] * chore: fix mypy issues * build: remove xgboost * chore: merge * chore: pre-commit auto fixes [...] * chore: address comments
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.
✨ Context
L2G training and prediction rewrite to use Scikit instead of pyspark.ml.
The main points that made me do this were:
Training end to end is now 18mins - job
Predicting is also 18 mins - job
This basically reassures me that annotating features is practically the entirety of the pipeline, which is consistent with my tests.
🛠 What does this PR implement
I've deprecated almost its entirety, so it's easier if i describe what this inclu
However, the L2G workflow is very similar to the previous one. This is just a change in the implementation that optimises the process.
LocusToGeneStep.run_train
creates a L2GModel based on aGradientBoostingClassifier
. The model is trained, exported to Hugging Face and saved locally.LocusToGeneStep.run_predict
downloads the model from the hub by default, and extracts scores.copy_to_gcs
util to move the L2G model local file into a GCS destination.LocusToGeneTrainer
is the addition ofhyperparameter_tuning
. This function uses Weights&Biases Sweeps, to sweep over all parameters provided in a grid, train a model, evaluate the results and upload them in a group. For example:(interesting that the metrics are the same) This is not part of the pipeline, only useful in development stages.
L2GFeatureMatrix
have 2 new attributesfixed_cols
, to complement the columns that are not features, andmode
. Both are connected, on train mode the fixed columns arestudyLocusId
,geneId
and the target column (goldStandardSet
); on predict mode, we don't have the latter one.LocusToGeneModel
gain 3 attributes: hyperparameters, training_data (to store the input feature matrix and log it to W&B), label_encoder. Features_list is no longer necessary.🙈 Missing
🚦 Before submitting
dev
branch?make test
)?poetry run pre-commit run --all-files
)?