xgb_synth / README.md
andreazhu's picture
Updated imports
1fa422c verified
|
Raw
History Blame Contribute Delete
2.2 kB
---
license: mit
tags:
- PROTAC
- drug-discovery
- cheminformatics
- regression
- xgboost
library_name: xgboost
pipeline_tag: tabular-regression
---
# PROTAC Synthesizability β€” XGBoost
An XGBoost regressor that predicts the **heavy-atom-count weighted synthesizability
score** (`hac_weighted_score`) of PROTAC molecules from SMILES.
Nested 5Γ—5 scaffold cross-validation, Optuna tuning. **Mean CV RΒ² = 0.565.**
## Files
- `xgb_v3_final.ubj` β€” XGBoost booster
- `xgb_v3_final.skops` β€” fitted preprocessor + target transformer
- `xgb_v3_hparams.yaml` β€” hyperparameters
(`.ubj` and `.skops` are both required to load the model.)
## Usage
Requires the project code: https://github.com/ribesstefano/PROTAC-Synthesizability
Install the package (editable) so `protac_synth` is importable, then:
```python
from protac_synth.models.xgb.model import XGBoostRegressor
from protac_synth.chem_utils import (
standardize_all, compute_fingerprints, compute_descriptors,
)
model = XGBoostRegressor.load("xgb_v3_final") # base path, no extension
smiles = ["O=C(O)c1ccccc1"]
# featurization consumes standardized RDKit Mols, not raw SMILES
mols = standardize_all(smiles)
preds = model.predict(
smiles,
X_fp=compute_fingerprints(mols, model.fp_size, model.fp_radius),
X_desc=compute_descriptors(mols),
)
```
Notes:
- `compute_fingerprints` / `compute_descriptors` take pre-standardized Mols
(from `standardize_all`), so each molecule is parsed and standardized once.
- Using `model.fp_size` / `model.fp_radius` guarantees the fingerprint settings
match those the model was trained with.
## Dependencies
The `.skops` preprocessor and the RDKit descriptor set are **version-sensitive** β€”
loading under a different version can raise `InconsistentVersionWarning` or produce
a feature-count mismatch. Pin the versions the model was exported with:
- `scikit-learn==1.6.1` (the version the `.skops` pipeline was saved with)
- `rdkit` β€” pin the exact version used at training; the RDKit descriptor list
changes across releases, and a mismatch changes the descriptor column count.
- `skops`, `xgboost`, `numpy` β€” pin to the training environment.
## License
MIT