MolALKit: A Toolkit for Active Learning in Molecular Data.
This software package serves as a robust toolkit designed for the active learning of molecular data.
Installation
Check the GPU and CUDA requirements at mgktools for marginalized graph kernel model. Non-CUDA installation is not supported.
Python 3.12, CUDA12.4, and GCC11.2 are recommended.
Minimum installation
pip install git+https://gitlab.com/Xiangyan93/graphdot.git@v0.8.2 molalkit
Support Chemprop
pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124
pip install git+https://github.com/Xiangyan93/chemprop4molalkit.git@v0.0.0
Support GraphGPS
pip install torch-scatter torch-sparse torch-geometric pytorch-lightning yacs torchmetrics performer-pytorch ogb git+https://github.com/Xiangyan93/graphgps4molalkit.git@v0.0.0 -f https://data.pyg.org/whl/torch-2.6.0+cu124.html
Support MolFormer
pip install transformers pytorch-fast-transformers git+https://github.com/Xiangyan93/molformer4molalkit.git@v0.0.1
APEX_CPP_EXT=1 APEX_CUDA_EXT=1 pip install -v --no-build-isolation git+https://github.com/NVIDIA/apex.git
Then download pretrained model at https://github.com/IBM/molformer.
QuickStart
GPU is required to support graph kernel. It will take about 10 minutes to set up the environment and run the demo.
Data
MolALKit currently supports active learning exclusively for single-task datasets, which can be either classification or regression tasks.
Custom Dataset
The data file must be in CSV format with a header row, structured as follows:
smiles,p_np
[Cl].CC(C)NCC(O)COc1cccc2ccccc12,1
C(=O)(OC(C)(C)C)CCCc1ccc(cc1)N(CCCl)CCCl,1
...
The following arguments are required to run the active learning
--data_path <dataset.csv> --smiles_columns <smiles> --targets_columns <target> --task_type <classification/regression>
Public Dataset
The toolkit incorporates several popular public datasets, such as MoleculeNet and TDC, which can be used directly --data_public <dataset name>.
Here is the list of available datasets:
from molalkit.data.datasets import AVAILABLE_DATASETS
print(AVAILABLE_DATASETS)
ActiveLearning/Validation Split
Our code supports several methods of splitting data into an active learning set and a validation set. The active learning is used for active learning and the validation set is used for evaluating the performance of the active learning model.
- random The data will be split randomly.
- scaffold_order With this approach, the data is split based on molecular scaffolds, ensuring that the same scaffold never appears in both the active learning and validation sets. The scaffold containing the most molecules is placed in the active learning set. This method aligns with the implementation in DeepChem and is independent of random seeds.
- scaffold_random In this method, the placement of scaffolds in either the active learning set or the validation set is done randomly. This split is dependent on random seeds and introduces an element of randomness into the scaffold split.
The following arguments are required for data split:
--split_type <random/scaffold_order/scaffold_random> --split_sizes <active learning set ratio> <validation set ratio> --seed <random seed>
Machine Learning Model
The machine learning model used in this package is described in a json config file. Here is the list of built-in machine learning models:
from molalkit.models.configs import AVAILABLE_MODELS
print(AVAILABLE_MODELS)
The model config files are placed in molalkit/models/configs. The following arguments are required for choosing machine learning models:
--model_configs <model_config_file>
First Example
Here's an example of running active learning using MolALKit with the BACE dataset, a 50:50 scaffold split, and Random Forest as the machine learning model:
molalkit_run --data_public bace --metrics roc_auc mcc accuracy precision recall f1_score --model_configs RandomForest_Morgan_Config --split_type scaffold_order --split_sizes 0.5 0.5 --evaluate_stride 10 --seed 0 --save_dir bace --init_size 2 --select_method explorative --s_batch_size 1 --max_iter 100
Metadata
Release files for molalkit 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| molalkit-1.2.0.tar.gz | 2.7 MB | Without provenance | Details for molalkit-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| molalkit-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for molalkit-1.2.0-py3-none-any.whl |
Total release size: 5.5 MB
Release files / molalkit-1.2.0.tar.gz
| Download URL | molalkit-1.2.0.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15b8026c524e65436f97bce99c42d32b00ac437f8e4b92b7aef08d2ee1d0623c
|
|
BLAKE2b-256 checksum How to use checksums |
2a27799193ba950b8c1863832800a4e6db67f4baae58eac1e5c5f85022384257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / molalkit-1.2.0-py3-none-any.whl
| Download URL | molalkit-1.2.0-py3-none-any.whl |
|---|---|
| Size | 2.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5c5f3da24c93fe262babae12052a042c0da48728bd3cade764a2035f87d7975
|
|
BLAKE2b-256 checksum How to use checksums |
a2e7f86249dd79ff6d69f5b8d54e485793e1f886b5e4515b1583d433666d22da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for molalkit 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.