andreazhu commited on
Commit
1fa422c
·
verified ·
1 Parent(s): a7bb43d

Updated imports

Browse files
Files changed (1) hide show
  1. README.md +29 -9
README.md CHANGED
@@ -14,7 +14,6 @@ pipeline_tag: tabular-regression
14
 
15
  An XGBoost regressor that predicts the **heavy-atom-count weighted synthesizability
16
  score** (`hac_weighted_score`) of PROTAC molecules from SMILES.
17
-
18
  Nested 5×5 scaffold cross-validation, Optuna tuning. **Mean CV R² = 0.565.**
19
 
20
  ## Files
@@ -29,22 +28,43 @@ Nested 5×5 scaffold cross-validation, Optuna tuning. **Mean CV R² = 0.565.**
29
 
30
  Requires the project code: https://github.com/ribesstefano/PROTAC-Synthesizability
31
 
 
 
32
  ```python
33
- from xgb.model import XGBoostRegressor
34
- from mol_utils import compute_fingerprints, compute_descriptors
 
 
35
 
36
  model = XGBoostRegressor.load("xgb_v3_final") # base path, no extension
37
  smiles = ["O=C(O)c1ccccc1"]
38
- preds = model.predict(smiles,
39
- X_fp=compute_fingerprints(smiles, 512, 2),
40
- X_desc=compute_descriptors(smiles))
 
 
 
 
 
41
  ```
42
 
 
 
 
 
 
 
43
  ## Dependencies
44
 
45
- Pin these for reproducible loading (`.skops` and RDKit are version-sensitive):
46
- `rdkit`, `scikit-learn`, `skops`, `xgboost`, `numpy`.
 
 
 
 
 
 
47
 
48
  ## License
49
 
50
- MIT
 
14
 
15
  An XGBoost regressor that predicts the **heavy-atom-count weighted synthesizability
16
  score** (`hac_weighted_score`) of PROTAC molecules from SMILES.
 
17
  Nested 5×5 scaffold cross-validation, Optuna tuning. **Mean CV R² = 0.565.**
18
 
19
  ## Files
 
28
 
29
  Requires the project code: https://github.com/ribesstefano/PROTAC-Synthesizability
30
 
31
+ Install the package (editable) so `protac_synth` is importable, then:
32
+
33
  ```python
34
+ from protac_synth.models.xgb.model import XGBoostRegressor
35
+ from protac_synth.chem_utils import (
36
+ standardize_all, compute_fingerprints, compute_descriptors,
37
+ )
38
 
39
  model = XGBoostRegressor.load("xgb_v3_final") # base path, no extension
40
  smiles = ["O=C(O)c1ccccc1"]
41
+
42
+ # featurization consumes standardized RDKit Mols, not raw SMILES
43
+ mols = standardize_all(smiles)
44
+ preds = model.predict(
45
+ smiles,
46
+ X_fp=compute_fingerprints(mols, model.fp_size, model.fp_radius),
47
+ X_desc=compute_descriptors(mols),
48
+ )
49
  ```
50
 
51
+ Notes:
52
+ - `compute_fingerprints` / `compute_descriptors` take pre-standardized Mols
53
+ (from `standardize_all`), so each molecule is parsed and standardized once.
54
+ - Using `model.fp_size` / `model.fp_radius` guarantees the fingerprint settings
55
+ match those the model was trained with.
56
+
57
  ## Dependencies
58
 
59
+ The `.skops` preprocessor and the RDKit descriptor set are **version-sensitive** —
60
+ loading under a different version can raise `InconsistentVersionWarning` or produce
61
+ a feature-count mismatch. Pin the versions the model was exported with:
62
+
63
+ - `scikit-learn==1.6.1` (the version the `.skops` pipeline was saved with)
64
+ - `rdkit` — pin the exact version used at training; the RDKit descriptor list
65
+ changes across releases, and a mismatch changes the descriptor column count.
66
+ - `skops`, `xgboost`, `numpy` — pin to the training environment.
67
 
68
  ## License
69
 
70
+ MIT