-
Notifications
You must be signed in to change notification settings - Fork 88
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
Implement DeepDDI model #63
Conversation
Please run |
Codecov Report
@@ Coverage Diff @@
## main #63 +/- ##
==========================================
+ Coverage 93.87% 93.93% +0.06%
==========================================
Files 29 29
Lines 832 858 +26
==========================================
+ Hits 781 806 +25
- Misses 51 52 +1
Continue to review full report at Codecov.
|
Hi there @hzcheney, do you plan to update this PR? |
Yes! I will update this PR ASAP. |
The formatting still fails. |
These are the errors: ./tests/unit/test_models.py:61:59: BLK100 Black would make changes. |
I am working on it, it's weird that I run |
Please help! I have no idea why these errors still happened:
Even I did not change the |
Yesterday,
|
Thank you! It's clear to me now. |
Hi there @hzcheney, I suggest updating black on your side. Do you want to finish the PR or we can overtake from you? |
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.
@cthoyt can you make these changes?
chemicalx/models/deepddi.py
Outdated
__all__ = [ | ||
"DeepDDI", | ||
] | ||
|
||
|
||
class DeepDDI(UnimplementedModel): | ||
class DeepDDI(Model): | ||
"""An implementation of the DeepDDI model. |
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.
Please change the docstring to include paper reference.
*, | ||
drug_channels: int, | ||
hidden_channels: int = 2048, | ||
hidden_layers_num: int = 9, |
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.
Can we setup a smaller number of layers and lower hidden channel number?
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.
@cthoyt can we have 4 layer with 32 hidden channels?
chemicalx/models/deepddi.py
Outdated
|
||
super(DeepDDI, self).__init__() | ||
assert hidden_layers_num > 1 | ||
dnn = [] |
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 would strongly suggest using a fixed number of layers. E.g. 3 or 4.
chemicalx/models/deepddi.py
Outdated
input_feature = torch.cat([drug_features_left, drug_features_right], 1) | ||
hidden = self.dnn(input_feature) | ||
return hidden | ||
|
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.
Remove spaces. The PR does not follow linting. Please use black to format your code. When you push again you can test it on the repo.
@@ -165,8 +165,22 @@ def test_ssiddi(self): | |||
|
|||
def test_deepddi(self): | |||
"""Test DeepDDI.""" | |||
model = DeepDDI(x=2) | |||
assert model.x == 2 |
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.
Create a test also for hidden_layer_num=1
.
* update: Add deepddi model * update: Add deepddi examples * update: Add deepddi test case * Style: deepddi model * Style: deepddi model * Style: deepddi_examples.py * Update deepddi.py * Update deepddi.py Co-authored-by: Charles Tapley Hoyt <cthoyt@gmail.com>
* CASTER layer implementation - only supervised training stage - input dimensionality assumed to be correct * Apply black and reorganize * Move loss into its own module * Update caster.py * Reduce diff on citation * Implement DeepDrug model (#68) * WIP: model forward pass works, not tested * added dropout and batch norm * WIP: made DeepDrug example, not tested * moved to using layers only, not GCN torchdrug model * docstring * added dropout and made context feats optional * added DeepDrug unit test * deepdrug self attribute fix * docstring update * unpack method update (when no context feats used) * isort * fixed test setting (context_channels) * fixed testing without context * black * RST fix * RST fix * more pythonic loop + swap i to _ * removed context feat support in DeepDrug * removed context handling from testing DeepDrug * fixed examples DeepDrug, no context handling, decreased epochs 100->20 * removed unused import * used a wrapper for calling the same layers on pairs of batches * used a wrapper for calling the same layers on pairs of batches * docstring fix * Abstract process applied to left and right sides * Apply black * Cleanup Co-authored-by: Charles Tapley Hoyt <cthoyt@gmail.com> * Add GCN-BMP (#71) * linting * GCNBMP Scatter Reduction fix * Using Rel Conv Layers instead of RGCN Model (avoid unecessary sum readouts) * Added docstrings and fixed highway update implementation * Make number of relationship configurable * little help of black for linting * Cleaning upuseless imports * Sharing attention between right and left side * Adding reference to GCNBMP docstring * Type hinting everything * Fixing docstring in example * - Removing type hints in docstrings as they were added to signatures - Chunked iteration of the BMP backbone for better readability * Ading more-itertools as a dependecy * Using pairwise for encoder construction * Adding missing docstrings * Fixing linting and precommit hook * Fixing the citation back to what is in main * Tests,formatting,example * Tests,formatting,example * GCNBMP * Cleanup Co-authored-by: kcvc236 <kcvc236@seskscpg057.prim.scp> Co-authored-by: Rozemberczki <kmdb028@astrazeneca.net> Co-authored-by: kcvc236 <kcvc236@seskscpg059.prim.scp> Co-authored-by: Charles Tapley Hoyt <cthoyt@gmail.com> * Implement DeepDDI model (#63) * update: Add deepddi model * update: Add deepddi examples * update: Add deepddi test case * Style: deepddi model * Style: deepddi model * Style: deepddi_examples.py * Update deepddi.py * Update deepddi.py Co-authored-by: Charles Tapley Hoyt <cthoyt@gmail.com> * CASTER review fixes * flake8 fixes * CASTER: typing fix Co-authored-by: Andriy Nikolov <kgsq682@astrazeneca.net> Co-authored-by: Charles Tapley Hoyt <cthoyt@gmail.com> Co-authored-by: Piotr Grabowski <3966940+kajocina@users.noreply.github.com> Co-authored-by: Michaël Ughetto <michael.ughetto@astrazeneca.com> Co-authored-by: kcvc236 <kcvc236@seskscpg057.prim.scp> Co-authored-by: Rozemberczki <kmdb028@astrazeneca.net> Co-authored-by: kcvc236 <kcvc236@seskscpg059.prim.scp> Co-authored-by: walter <32014404+hzcheney@users.noreply.github.com>
Closes #2
Changes