choderalab / pinot

Probabilistic Inference for NOvel Therapeutics
MIT License
15 stars 2 forks source link

Generative model v2 #54

Closed dnguyen1196 closed 4 years ago

dnguyen1196 commented 4 years ago

A follow up from PR #50 and with major changes.

Major changes were made to generative model. Before, we would compute the loss function of the variational auto-encoder by working directly with the batched graph. The function binary_cross_entropy does not however work with sparse adjacency matrix. As a result, one needs to pass the full dense adjacency matrix. However, when we have a lot of subgraphs, this will take too much memory. In addition, when we have a lot of subgraphs, the number of "negative" (absent) edges will outnumber the number of positive (present) edges. In the extreme case where we have a very small percentage of edges being positive, this imbalance will result in the generative model more disproportionately generate negative edges.

Therefore, the new version of generative model, will work at the subgraph level.

The input can still be a batched graph. However, the generative model will now automatically extract the component subgraphs and compute loss based on these subgraphs. One immediate downside of this change is an increase in time during training of generative model. However, if we separate the training of the generative model from Net, training of the latter will not change if it uses the pretrain generative model as representation because the changes only affect the decoder part of the generative model. On the other hand Net uses the encoder part of the generative model.

lgtm-com[bot] commented 4 years ago

This pull request introduces 3 alerts and fixes 2 when merging 94aae698e0b24f9ad90441b27dd51193d06b31cc into 0548dcd7b78be04c9a953614e4d4a78ef0624170 - view on LGTM.com

new alerts:

fixed alerts: