-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9de1989
commit 371b51b
Showing
20 changed files
with
2,241 additions
and
4,357 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
# AttentionDDI | ||
|
||
This repository contains the code for the AttentionDDI model implementation with PyTorch. | ||
|
||
AttentionDDI is a Siamese multi-head self-Attention multi-modal neural network model used for drug-drug interaction (DDI) predictions. | ||
# side-effects | ||
|
||
## Installation | ||
|
||
* `git clone` the repo and `cd` into it. | ||
* Run `pip install -e .` to install the repo's python package. | ||
|
||
## Running | ||
|
||
1. use `notebooks/jupyter/AttnWSiamese_data_generation.ipynb` to generate DataTensors from the drug similarity matrices. | ||
2. use `notebooks/jupyter/AttnWSiamese_hyperparam.ipynb` to find the best performing model hyperparameters. | ||
3. use `notebooks/jupyter/AttnWSiamese_train_eval.ipynb` to train / test on the best hyperparameters. | ||
4. use `notebooks/jupyter/AttnWSiamese_AttnWeights.ipynb` to plot the Attention weights. | ||
* Run `pip install -e .` to install the repo's python package. |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import torch | ||
from torch import nn | ||
import torch.nn.functional as F | ||
|
||
class NDD_Code(nn.Module): | ||
def __init__(self, D_in=1096, H1=400, H2=300, D_out=1, drop=0.5): | ||
super(NDD_Code, self).__init__() | ||
# an affine operation: y = Wx + b | ||
self.fc1 = nn.Linear(D_in, H1) # Fully Connected | ||
self.fc2 = nn.Linear(H1, H2) | ||
self.fc3 = nn.Linear(H2, D_out) | ||
self.drop = nn.Dropout(drop) | ||
self._init_weights() | ||
|
||
def forward(self, x): | ||
x = F.relu(self.fc1(x)) | ||
x = self.drop(x) | ||
x = F.relu(self.fc2(x)) | ||
x = self.drop(x) | ||
x = self.fc3(x) | ||
return x | ||
|
||
def _init_weights(self): | ||
for m in self.modules(): | ||
if(isinstance(m, nn.Linear)): | ||
nn.init.xavier_normal_(m.weight.data) | ||
m.bias.data.uniform_(-1,0) |
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
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
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
Oops, something went wrong.