This repository implements an end-to-end classification pipeline for benchmark microarray gene-expression datasets. It focuses on selecting a compact set of informative genes and comparing multiple classifiers under cross-validation and held-out testing.
Two datasets are included in ARFF format:
-
SRBCT: Multi-class classification (4 tumor types). File:
SRBCT.arff. 83 instances with 2308 features (genes) and class information. -
Colon Tumor: Binary classification (Tumor vs Normal). File:
Colon.arff. 62 instances with 2000 features, and binary class information.
Dataset source: https://csse.szu.edu.cn/staff/zhuzx/Datasets.html
Reference paper: Zhu et al., 2007, “Markov blanket-embedded genetic algorithm for gene selection”.
- SRBCT is loaded using
scipy.io.arff.loadarffand class labels are decoded and converted to integers. - Colon Tumor is parsed manually because the ARFF header contains duplicate gene identifiers; duplicates are disambiguated by appending suffixes (e.g.,
R39465_1,R39465_2). Labels are mapped to Tumor = 1, Normal = 0.
Standard microarray EDA visualizations are generated for each dataset, including class distribution, per-gene box/violin plots, histograms, summary-statistic heatmaps, and correlation heatmaps.
Data are split into 80% training and 20% test sets before feature selection and normalization to reduce data leakage risk.
Feature selection is run on the training set and then applied to the test set:
- Mutual Information: selects the top 50 genes.
- RFE (Recursive Feature Elimination) with Logistic Regression: selects 50 genes.
- LASSO (LassoCV): ranks coefficients and keeps the top 50 genes by absolute magnitude.
Selected gene-expression features are standardized with StandardScaler, fit only on the training set, and then applied to both training and test data.
The pipeline compares five model families:
- Random Forest (RF)
- Support Vector Machine (SVM)
- Linear Discriminant Analysis (LDA)
- XGBoost
- Multi-Layer Perceptron (MLP; Keras/TensorFlow)
For RF/SVM/LDA/XGBoost, 5-fold cross-validation is performed via GridSearchCV for hyperparameter selection. For the MLP, 5-fold StratifiedKFold is performed with early stopping and learning-rate scheduling, then a final model is trained on the full training split.
Evaluation includes accuracy, F1, precision, recall, and confusion matrices, reported on the held-out test set.
The following results are reported as accuracy (%) under 5-fold cross-validation (CV) and on the held-out test set after selecting 50 genes. Values are taken from the performed experiments in this repository (the exact numbers can vary with different splits, seeds, and library versions).
| Feature selection | RF (CV/Test) | SVM (CV/Test) | LDA (CV/Test) | XGBoost (CV/Test) | MLP (CV/Test) |
|---|---|---|---|---|---|
| Mutual Information | 100.0 / 100.0 | 100.0 / 100.0 | 100.0 / 100.0 | 95.6 / 100.0 | 100.0 / 100.0 |
| RFE | 100.0 / 100.0 | 100.0 / 100.0 | 100.0 / 100.0 | 95.6 / 100.0 | 98.6 / 100.0 |
| LASSO | 96.9 / 100.0 | 98.5 / 94.1 | 96.9 / 88.2 | 93.9 / 94.1 | 95.4 / 94.1 |
Key observation: for SRBCT, perfect test accuracy is achieved for all models under Mutual Information and RFE in the reported runs; LASSO yields lower test accuracy for several models.
| Feature selection | RF (CV/Test) | SVM (CV/Test) | LDA (CV/Test) | XGBoost (CV/Test) | MLP (CV/Test) |
|---|---|---|---|---|---|
| Mutual Information | 92.0 / 76.9 | 94.0 / 76.9 | 92.0 / 84.6 | 89.6 / 76.9 | 89.8 / 84.6 |
| RFE | 86.0 / 76.9 | 92.0 / 76.9 | 92.0 / 84.6 | 83.8 / 84.6 | 94.0 / 76.9 |
| LASSO | 83.6 / 76.9 | 91.8 / 69.2 | 87.6 / 84.6 | 87.8 / 69.2 | 91.8 / 76.9 |
Key observation: for Colon Tumor, the best reported test accuracy is 84.6%, most consistently reached by LDA across all three feature-selection approaches.
- Figures and confusion matrices are generated during execution.
- Example figures and result screenshots are provided under
analyses/(EDA plots, feature-selection plots, and summary comparisons).
- Ensure
SRBCT.arffandColon.arffare in the working directory. - Run
gene_expression_levels.pycell-by-cell (it is organized with#%%sections for an IDE workflow similar to a notebook).
Core: numpy, pandas, scipy, matplotlib, seaborn
ML: scikit-learn, xgboost, tensorflow (Keras)
- The Colon dataset contains duplicate gene names in the ARFF header; duplicates are resolved by creating unique column names.
- Reported results can vary slightly with different train/test splits or random seeds.
📫 Contact me at memisoguzhants@gmail.com
I'm waiting for your suggestions and contributions.