Drug Bioactivity Predictor
A machine-learning model for predicting whether a chemical compound is likely to be active or inactive against EGFR based on its molecular structure represented as a SMILES string.
The model uses RDKit molecular descriptors and Morgan molecular fingerprints as input features and a Random Forest classifier for binary classification.
Research use only: This model is intended for educational, research, and compound-prioritization purposes. It is not a clinical diagnostic tool and must not be used to make medical, therapeutic, regulatory, or patient-care decisions.
Model Overview
| Property | Value |
|---|
| Target | EGFR |
| ChEMBL Target ID | CHEMBL203 |
| Assay endpoint | IC50 |
| Activity unit | nM |
| Task | Binary classification |
| Active threshold | IC50 ≤ 1000 nM |
| Inactive threshold | IC50 > 1000 nM |
| Model | Random Forest Classifier |
| Molecular descriptors | 8 |
| Morgan fingerprint | 2048 bits |
| Total features | 2056 |
Objective
The objective of this project is to develop an end-to-end machine-learning pipeline that takes a compound SMILES string and predicts:
against the EGFR target.
The project combines:
- Chemical data curation
- Cheminformatics
- Molecular descriptors
- Molecular fingerprints
- Machine learning
- Model evaluation
- Scaffold-based validation
- Interactive Streamlit deployment
Input
The model accepts a valid chemical SMILES representation.
Example:
or:
The SMILES is converted into an RDKit molecular representation before feature generation.
Feature Engineering
Each molecule is represented using two feature groups.
Molecular descriptors
The following eight descriptors are calculated using RDKit:
- Molecular Weight
- LogP
- Hydrogen Bond Donors
- Hydrogen Bond Acceptors
- Rotatable Bonds
- Topological Polar Surface Area
- Ring Count
- Heavy Atom Count
Morgan fingerprint
A Morgan circular fingerprint is generated using:
1Radius: 2
2Fingerprint size: 2048 bits
Therefore:
18 descriptors
2+
32048 Morgan fingerprint bits
4=
52056 features
Activity Definition
The curated dataset uses an IC50 threshold of:
Classification:
1IC50 ≤ 1000 nM
2 ↓
3 ACTIVE
1IC50 > 1000 nM
2 ↓
3 INACTIVE
This threshold is a project-level classification rule and should not be interpreted as a universal biological definition of EGFR activity.
Dataset
The final curated dataset contains:
Class distribution:
| Class | Compounds | Fraction |
|---|
| ACTIVE | 9,142 | 67.33% |
| INACTIVE | 4,435 | 32.67% |
| Total | 13,577 | 100% |
The data curation pipeline includes:
- Removal of invalid measurements
- IC50 filtering
- Unit normalization
- Missing-value handling
- SMILES validation
- Duplicate measurement removal
- Compound-level aggregation
- Activity classification
Model Comparison
Three machine-learning models were evaluated.
| Model | Accuracy | Precision | Recall | F1 | ROC-AUC | PR-AUC |
|---|
| Logistic Regression | 0.8384 | 0.8913 | 0.8655 | 0.8782 | 0.8776 | 0.9193 |
| Random Forest | 0.8921 | 0.9364 | 0.9010 | 0.9184 | 0.9512 | 0.9743 |
| XGBoost | 0.8840 | 0.9079 | 0.9213 | 0.9145 | 0.9410 | 0.9690 |
The Random Forest model was selected based primarily on ROC-AUC.
Random-Split Evaluation
The selected Random Forest model achieved:
| Metric | Score |
|---|
| Accuracy | 0.8921 |
| Precision | 0.9364 |
| Recall | 0.9010 |
| F1 | 0.9184 |
| ROC-AUC | 0.9512 |
| PR-AUC | 0.9743 |
Five-fold cross-validation produced:
1Mean ROC-AUC: 0.9478
2Std ROC-AUC : 0.0054
Scaffold-Split Evaluation
A Bemis-Murcko scaffold split was additionally performed to evaluate generalization to chemically different molecular scaffolds.
Results:
| Metric | Score |
|---|
| Accuracy | 0.8401 |
| Precision | 0.8760 |
| Recall | 0.8884 |
| F1 | 0.8822 |
| ROC-AUC | 0.9118 |
| PR-AUC | 0.9551 |
The scaffold split is more challenging than a conventional random split because structurally related compounds are less likely to appear across both training and test sets.
Generalization
The difference between random-split and scaffold-split ROC-AUC was:
1Random split ROC-AUC = 0.9512
2Scaffold split ROC-AUC = 0.9118
3
4Generalization gap = 0.0394
The scaffold evaluation provides a more conservative estimate of how the model may perform on chemically distinct compounds.
Model Files
This repository contains:
1bioactivity_model.joblib
2model_metadata.json
3README.md
bioactivity_model.joblib
Serialized scikit-learn Random Forest model.
model_metadata.json
Contains model configuration and reproducibility metadata including:
- Target information
- Activity threshold
- Feature configuration
- Molecular descriptors
- Morgan fingerprint configuration
- Validation metrics
- Dataset statistics
- Software versions
Example Inference
A compound can be processed using the project's prediction wrapper.
Example:
1from src.predict import BioactivityPredictor
2
3predictor = BioactivityPredictor(
4 "models/bioactivity_model.joblib"
5)
6
7result = predictor.predict(
8 "CCOC1=CC=CC=C1"
9)
10
11print(result["prediction"])
12print(result["active_probability"])
Example output:
The probability represents the model's estimated probability for the predicted class and should not be interpreted as a calibrated probability of biological efficacy.
Application
The model is integrated into an interactive Streamlit application.
The application supports:
- SMILES input
- SMILES validation
- Molecular property calculation
- ACTIVE/INACTIVE prediction
- Prediction probability
- CSV batch prediction
- Molecular descriptors
- Chemical structure visualization
Technology Stack
Programming
Cheminformatics
Data Science
Machine Learning
- Scikit-learn
- XGBoost
- Joblib
Visualization
Application
Development
- JupyterLab
- Pytest
- Ruff
- Git
- GitHub
- Hugging Face Hub
Project Architecture
1SMILES
2 │
3 ▼
4RDKit Molecular Parsing
5 │
6 ├───────────────┐
7 │ │
8 ▼ ▼
9Molecular Morgan
10Descriptors Fingerprint
11 │ │
12 └───────┬───────┘
13 ▼
14 2056 Features
15 │
16 ▼
17 Random Forest
18 │
19 ▼
20 ┌─────────┴─────────┐
21 │ │
22 ▼ ▼
23ACTIVE INACTIVE
24 │
25 ▼
26Probability
Limitations
This model has several important limitations.
1. Target-specific model
The model was trained for:
It should not automatically be assumed to generalize to other biological targets.
2. Endpoint-specific model
The training endpoint is:
The model should not be interpreted as a predictor for other assay endpoints such as:
- EC50
- Ki
- Kd
- cellular viability
- toxicity
- clinical response
without appropriate retraining and validation.
3. Dataset bias
Bioactivity databases contain heterogeneous experimental measurements generated using different:
- assay protocols
- experimental conditions
- laboratories
- compound series
- measurement practices
Therefore, the model may inherit biases present in the underlying data.
4. Chemical space limitations
Performance can decrease for molecules substantially different from the training distribution.
The scaffold-split ROC-AUC of approximately 0.912 demonstrates that performance is lower under a more challenging chemical split than under a random split.
5. Probability calibration
The predicted probability is a machine-learning model output and has not been established as a clinically calibrated probability of biological activity.
6. No clinical interpretation
The model does not predict:
- drug approval
- therapeutic efficacy
- patient response
- toxicity
- pharmacokinetics
- pharmacodynamics
- clinical safety
Intended Use
Appropriate uses include:
- Educational cheminformatics projects
- Machine-learning research
- Molecular data analysis
- Computational compound prioritization
- Benchmarking molecular fingerprints
- Exploring structure-activity relationships
- Prototyping drug-discovery workflows
Out-of-Scope Use
This model should not be used as the sole basis for:
- Clinical decisions
- Drug prescribing
- Patient treatment
- Regulatory submissions
- Safety-critical decisions
- Confirmation of biological activity
- Replacement of laboratory experiments
Predictions should be experimentally validated before drawing biological conclusions.
Reproducibility
The project includes:
- Data curation scripts
- Feature generation
- Model training
- Model evaluation
- Scaffold evaluation
- Automated tests
- Model metadata
- Evaluation reports
The software environment is documented in the project requirements files.
Repository
Source code:
Hugging Face model:
Disclaimer
This project is a research and educational machine-learning application.
Predictions are computational estimates and do not constitute experimental evidence of biological activity, medical advice, or clinical recommendations.
Any compound prioritization based on this model should be followed by appropriate experimental validation.
Future Improvements
Potential future improvements include:
- Probability calibration
- External validation on independent datasets
- Larger multi-target datasets
- Additional molecular fingerprints
- Graph neural networks
- Molecular transformers
- Explainable AI
- Applicability-domain estimation
- Uncertainty quantification
- Active learning
- Multi-task bioactivity prediction
- Experimental validation