This repository contains a Jupyter notebook for the MPHY0041 module coursework. The notebook demonstrates statistical and machine learning techniques applied to a biomedical dataset, with a focus on classification tasks for dementia diagnosis.
The notebook is structured into two main exercises:
This section explores different methods for modeling decision boundaries in a classification context.
-
(a) Univariate Decision Boundary
Visualization of a simple threshold-based classifier using one feature. -
(b) Linear Regression Boundary
Analysis of the inadequacy of linear regression for classification tasks using continuous decision boundaries. -
(c) Multimodal Boundary
Investigation of nonlinear or multimodal decision boundaries and how they behave across different feature spaces.
This part focuses on implementing and analyzing logistic regression using various optimization techniques. The dataset includes features extracted from patient data for dementia classification (e.g., CN vs. MCI vs. AD).
-
(a) Logistic Regression via Iteratively Reweighted Least Squares (IWLS)
- Manual implementation of IWLS to estimate model parameters.
- Comparison of coefficients with
sklearnβs logistic regression output.
-
(b) Logistic Regression using Gradient Descent
- Implementation of logistic regression using custom gradient descent.
- Comparison with IWLS in terms of coefficient magnitudes and convergence.
-
(c) Logistic Regression with L2 Regularization
- Extension of gradient descent by adding a regularization term to prevent overfitting.
- Demonstrates the effect of regularization strength on coefficient shrinkage.
- Plots showing convergence of cost functions, coefficient behavior, and decision boundaries
Notebook_MPHY0041_2425_CW1.ipynb: Core analysis notebook
Install required Python libraries using:
pip install numpy pandas matplotlib seaborn scikit-learn