Activity Cliff Awareness
Code repository for activity cliff-awareness (ACA) loss and graph-based ACANet model
About
1) ACALoss
This study proposes the activity-cliff-awareness (ACA) loss for improving molecular activity prediction by deep learning models. The ACA loss enhances both metric learning in the latent space and task learning in the target space during training, making the network aware of the activity-cliff issue. For more details, please refer to the paper titled "Online triplet contrastive learning enables efficient cliff awareness in molecular activity prediction."
2) ACANet
ACANet is a deep learning model that developed based on the proposed ACALoss and graph neural network. It can tune the hyperparameters of ACALoss automatically, and provides a high-level interface of training and test in the deep learning model (Users can use it just like scikit-learn)
Model performance of with and without AC-Awareness
ACA loss vs. MAE loss on external test set and on No. of mined triplets during the training:
More details on usage and performance can be found here.
ACA loss implementation
ACA loss usage
#Pytorch
from clsar.model.loss import ACALoss
aca_loss = ACALoss(alpha=0.1, cliff_lower = 0.2, cliff_upper = 1.0, p = 1., squared = False)
loss = aca_loss(labels, predictions, embeddings)
loss.backward()
#Tensorflow
from clsar.model.loss_tf import ACALoss
Installation
pip install clsar
Run ACANet
from clsar import ACANet
#Xs_train: list of SMILES string of training set
#y_train_pIC50: the pChEMBL labels of training set
## init ACANet
clf = ACANet(gpuid = 0, work_dir = './')
## get loss hyperparameters (cliff_lower, cliff_upper, and alpha) by training set
dfp = clf.opt_cliff_by_cv(Xs_train, y_train_pIC50, total_epochs=50, n_repeats=3)
dfa = clf.opt_alpha_by_cv(Xs_train, y_train_pIC50, total_epochs=100, n_repeats=3)
## fit model using 5fold cross-validation
clf.cv_fit(Xs_train, y_train_pIC50, verbose=1)
## make prediction using the 5-submodels, the outputs are the average of the 5-submodels
test_pred_pIC50 = clf.cv_predict(Xs_test)
Citation
SHEN W, Cui C, Su X, Zhang Z, Velez-Arce A, Wang J, et al. Activity Cliff-Informed Contrastive Learning for Molecular Property Prediction. ChemRxiv. 2024; doi:10.26434/chemrxiv-2023-5cz7s-v2.
Metadata
Release files for clsar 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clsar-2.0.2.tar.gz | 40.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clsar-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 81.7 kB
Release files / clsar-2.0.2.tar.gz
| Download URL | clsar-2.0.2.tar.gz |
|---|---|
| Size | 40.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2ab4690fb192b76f5dac1b994c30dce0701e2f07899aca1a09ab6f97583ef3a
|
|
BLAKE2b-256 checksum How to use checksums |
69f435887f0d66e65e2bf32bc8a8abb0e4691e33a202bf20238fc07fe528a590
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.24
|
Release files / clsar-2.0.2-py3-none-any.whl
| Download URL | clsar-2.0.2-py3-none-any.whl |
|---|---|
| Size | 41.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a02accacd520cfef415232ce136f25feb174c1af6cc294c8dc90ca903766a4c
|
|
BLAKE2b-256 checksum How to use checksums |
1e336bdd9f3497558e595d2a4c808f320fd65d04e47eb15fd5266af612b9527a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.24
|