Skip to content

Ali-Daher1/Molecule_Toxicity_Classification

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Molecule Toxicity Classification

A machine learning project that predicts whether a molecule is toxic or non-toxic from its computed chemical descriptors. It's a binary classification problem on an imbalanced dataset (about 108 non-toxic vs 51 toxic molecules), so a lot of the work is about feature selection and handling the class imbalance rather than just fitting a model.

Approach

The raw data has a very large number of molecular descriptors (topological, autocorrelation, BCUT, ETA indices, etc.), far more than the ~159 molecules, so feature selection is the core of the project. The notebook (XGBoost_molecule.ipynb) works through several strategies and compares them:

  • Dimensionality reduction: PCA, PCA + RFE, PCA + t-SNE
  • Recursive feature elimination (RFE)
  • A cardinality sweep that tests how many features give the best cross-validated accuracy, followed by iterative pruning

The sweep found that around 12 descriptors gave the best cross-validated accuracy (~0.82 mean CV), and pruning below that didn't help. Those 12 features are what the final model uses.

Final model

Toxicity.ipynb is the clean final pipeline:

  1. Keep the 12 selected descriptors.
  2. SMOTE to oversample the minority (toxic) class on the training folds — this trades a little overall accuracy for better recall on toxic molecules, which is the right trade-off when a missed toxic molecule is the costly error.
  3. StandardScaler + XGBClassifier (100 trees, depth 3, learning rate 0.1).
  4. Evaluated with 5-fold stratified cross-validation.

On a held-out test set the model reached about 0.78 accuracy, with recall on the toxic class around 0.70 — the metric that actually matters here.

Running it

pip install pandas numpy scikit-learn xgboost imbalanced-learn

Open Toxicity.ipynb for the final pipeline, or XGBoost_molecule.ipynb for the full feature-selection exploration. Both expect the descriptor CSV in the same folder.

About

Toxicity prediction from molecular descriptors: feature selection plus XGBoost with SMOTE for class imbalance.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages