It is known that DNA methylation data capture chemical changes in DNA where methyl groups are added to specific sites, mainly CpG regions. These changes do not alter the DNA sequence but they can influence gene activity. Importantly, methylation patterns shift in a consistent way as people age, making them a reliable biomarker of biological ageing and an indicator of an individual’s physiological condition. In this assignment we implemented a complete machine learning pipeline for predicting chronological age from DNA methylation data, a key biomarker of biological ageing. DNA methylation refers to the addition of methyl groups to cytosine bases at CpG dinucleotides and is known to change systematically across the human genome with age. These patterns can be measured using microarray technologies and leveraged to build predictive models, commonly referred to as epigenetic clocks, which have important applications in ageing research, disease detection, and lifespan studies.
I build a full machine learning pipeline that cleans and preprocesses the data, tests different models to predict age from DNA data, selects the most useful features (CpG sites), tunes the models to get the best performance, and as a bonus also predicts sex from the same data.
My best model (ElasticNet) predicted age with an average error of about 4.9 years on unseen data.
- src/functions.py,all the functions I wrote
- notebooks/data_exploration.ipynb, data loading and exploration
- notebooks/model_analysis.ipynb, model training and evaluation
- models/best_model.pkl, the saved best model
Put the data files in the data folder and run the notebooks in order.
numpy, pandas, scikit-learn, scipy, mrmr-selection, optuna, matplotlib