-
Notifications
You must be signed in to change notification settings - Fork 3
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
SGD learning rate tuning + pytorch implementation, simulations #81
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
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
arielah
approved these changes
May 31, 2023
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 glad you checked this out! Some interesting results in here, and they'll definitely be interesting for the paper.
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.
Sorry in advance - this is kind of a large PR with no super obvious way to split it up into smaller ones. I'll summarize some of the main changes I'm making in this PR below, and if you want to review each of those individually feel free to do that and just approve once you finish them all.
Main changes:
Tune learning rate for SGD optimizer: see changes to
01_stratified_classification/run_stratified_lasso_penalty.py
,01_stratified_classification/scripts/run_lasso_lr_compare.sh
, parts ofpancancer_evaluation/prediction/classification.py
andpancancer_evaluation/utilities/classify_utilities.py
. This turns out to matter quite a bit for SGD performing well, and once we use a slightly more sophisticated approach for tuning the learning rate (constant learning rate + a grid search in this case) we get much better performance, on par withliblinear
.Try a pytorch implementation of SGD: we did this primarily to make sure the SGD performance/regularization dynamics weren't specific to the sklearn implementation. These changes are in
01_stratified_classification/run_stratified_nn.py
andpancancer_evaluation/prediction/classification.py
(thetrain_mlp_lr
function primarily). We probably won't end up using these results for much in the paper, but it was a useful sanity check.Try SGD and liblinear on some simulated data: these are the
01_stratified_classification/sgd_params/sim.ipynb
and01_stratified_classification/sgd_params/sim_lr.ipynb
notebooks. I used these to iterate quickly on the learning rate changes and compare our results to L2 regularization, but the results turn out to be a bit different on real data so I'm not sure how applicable this simulation approach is to the problem we're trying to address in our paper. I want to keep these scripts around for future reference, though.I have a summary of the main plots/conclusions in these slides, in case they help a bit with putting the results in context: https://docs.google.com/presentation/d/1LRBq_ciFeS503J8-GeH51l-1p4RTdWJPn_LcGhHNjgM/edit?usp=sharing. Let me know if you have questions!