CoolFace
Apppublic

aaronmuli/genomic-variant-classification

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
App README

๐Ÿงฌ Genomic Variant Clinical Classification System

An end-to-end machine learning pipeline for classifying cancer-associated genomic variants using clinical evidence text.

๐Ÿ“Œ Project Overview

This project implements a production-ready NLP + gradient boosting pipeline for classifying somatic genomic variants into clinically relevant categories based on associated medical literature.

The system ingests structured mutation metadata and unstructured clinical evidence text, performs advanced feature extraction, and trains a multi-class probabilistic classifier optimized using log-loss โ€” a metric appropriate for medical decision systems.

This project demonstrates:

  • โ€”Applied Natural Language Processing (NLP)
  • โ€”Multi-class classification modeling
  • โ€”Feature engineering for biomedical text
  • โ€”Gradient boosting optimization
  • โ€”Model persistence and deployment readiness

๐Ÿง  Problem Statement

In oncology and precision medicine, genomic mutations must be interpreted and categorized based on evidence from scientific literature.

Manual interpretation:

  • โ€”Is time-consuming
  • โ€”Requires expert knowledge
  • โ€”Does not scale with growing biomedical publications

This project builds a machine learning system capable of automatically predicting variant classification based on:

  • โ€”Gene name
  • โ€”Specific mutation
  • โ€”Clinical evidence text

๐Ÿ—‚ Dataset

The dataset contains:

FeatureDescription
IDVariant identifier
GeneGene symbol
VariationSpecific mutation
Clinical_EvidenceAssociated medical literature text
ClassTarget classification (1โ€“9)

The classification is multi-class (9 categories).


๐Ÿ— Architecture

1๏ธโƒฃ Data Pipeline

  • โ€”Custom dataset loader
  • โ€”Text cleaning (medical citation removal, normalization)
  • โ€”Structured + unstructured feature merging

2๏ธโƒฃ Feature Engineering

  • โ€”TF-IDF vectorization (word n-grams)
  • โ€”Biomedical text normalization
  • โ€”Gene and mutation metadata integration
  • โ€”Sparse matrix optimization

3๏ธโƒฃ Model

  • โ€”XGBoost multi-class classifier
  • โ€”Objective: multi:softprob
  • โ€”Evaluation metric: Multi-class Log Loss
  • โ€”Stratified train-test split

4๏ธโƒฃ Model Persistence

  • โ€”Model saved using joblib
  • โ€”Vectorizer saved separately
  • โ€”Separate inference script for deployment

โš™๏ธ Technology Stack

  • โ€”Python 3.x
  • โ€”Pandas
  • โ€”Scikit-learn
  • โ€”XGBoost
  • โ€”TF-IDF Vectorization
  • โ€”Joblib (model persistence)

๐Ÿ“Š Model Evaluation

The model is evaluated using:

  • โ€”Multi-class Log Loss
  • โ€”Accuracy score

Log-loss is chosen because:

  • โ€”It penalizes overconfident incorrect predictions
  • โ€”It is suitable for probabilistic medical classification tasks

๐Ÿš€ How To Run

1๏ธโƒฃ Train the Model

bash
python train.py

This will:

  • โ€”Load and merge data
  • โ€”Extract TF-IDF features
  • โ€”Train the XGBoost classifier
  • โ€”Save the model and vectorizer

Saved files:

models/
 โ”œโ”€โ”€ xgb_variant_model.pkl
 โ””โ”€โ”€ tfidf_vectorizer.pkl

2๏ธโƒฃ Run Inference

bash
python predict.py

This will:

  • โ€”Load the trained model
  • โ€”Clean input text
  • โ€”Transform using saved TF-IDF vocabulary
  • โ€”Output predicted class and probabilities

๐Ÿ” Engineering Highlights

โœ” Clean Modular Design

  • โ€”Separate loader
  • โ€”Separate training logic
  • โ€”Separate inference script

โœ” Reproducibility

  • โ€”Fixed random seed
  • โ€”Stratified splitting
  • โ€”Saved vectorizer vocabulary

โœ” Production-Oriented

  • โ€”No refitting during inference
  • โ€”Serialized artifacts
  • โ€”Predict_proba support for decision thresholds

โœ” Scalable

  • โ€”Sparse matrix optimization
  • โ€”Compatible with LightGBM or transformer upgrades
  • โ€”Ready for API deployment

๐Ÿงช Example Prediction

Input:

BRAF V600E mutation associated with melanoma and response to targeted therapy.

Output:

Predicted Class: 3
Class Probabilities: [0.02, 0.11, 0.63, ...]

๐Ÿ”ฌ Future Improvements

Planned enhancements include:

  • โ€”Character-level TF-IDF for mutation pattern capture
  • โ€”Hyperparameter optimization
  • โ€”Model stacking
  • โ€”LightGBM comparison
  • โ€”Transformer-based biomedical embeddings (BioBERT / SciBERT)
  • โ€”REST API deployment (FastAPI)
  • โ€”Docker containerization
  • โ€”Clinical explainability layer (SHAP values)

๐Ÿ“ˆ Potential Applications

  • โ€”Clinical decision support systems
  • โ€”Precision oncology pipelines
  • โ€”Automated mutation triage systems
  • โ€”Biomedical research indexing
  • โ€”Health-tech AI platforms

๐Ÿง‘โ€๐Ÿ’ป Author

Aaron Muliyunda Medical Student | Software Engineer | AI Systems Builder

Focused on building intelligent healthcare systems that bridge medicine and machine learning.