RPCAMachine LearningImage Classification

Principal Component Analysis of Brain MRIs for Glioma Detection

A machine learning project that preprocesses brain MRI scans (with and without glioma tumors), reduces dimensionality via PCA, and applies classification and clustering techniques to improve diagnostic pattern recognition.

Overview

This project applies machine learning techniques to brain MRI images for the detection of glioma tumors. Working in RStudio, I preprocessed MRI scans — both from patients with gliomas and healthy controls — then used Principal Component Analysis (PCA) to reduce the high-dimensional image data into a manageable set of principal components that capture the most informative variation.

The reduced-dimensionality features were then fed into multiple classification algorithms — Logistic Regression, Linear Discriminant Analysis (LDA), and k-Nearest Neighbors (KNN) — as well as clustering techniques to identify natural groupings in the data that may correspond to tumor presence or characteristics.

Motivation

Glioma is one of the most common and aggressive types of brain tumors, and early, accurate detection from MRI scans is critical for patient outcomes. Machine learning approaches offer the potential to automate or augment tumor detection by identifying subtle patterns in imaging data that may not be immediately apparent to human observers.

Data Preprocessing

  • Image Standardization: Normalizing pixel intensities across scans to account for differences in imaging equipment and protocols.
  • Noise Reduction: Applying filtering techniques to reduce artifacts while preserving diagnostically relevant features.
  • Dimensionality Assessment: Each MRI image contains thousands of pixels, creating a high-dimensional feature space that is computationally challenging and prone to overfitting — motivating the use of PCA for dimensionality reduction.

Classification & Clustering

  • Logistic Regression: A baseline linear classifier that models the probability of tumor presence as a function of principal components. Provides interpretable coefficients indicating which image features are most predictive.
  • Linear Discriminant Analysis (LDA): Finds linear combinations of features that best separate the two classes (tumor vs. no tumor). LDA assumes normally distributed classes with equal covariance, making it well-suited for this type of binary classification task.
  • k-Nearest Neighbors (KNN): A non-parametric classifier that assigns labels based on the majority class among the k closest training examples in feature space. KNN captures local patterns without assuming a specific functional form.

Additionally, hierarchical clustering was applied to explore natural groupings in the data without using labels, providing an unsupervised perspective on whether tumor and non-tumor cases form distinct clusters.

Key Findings

The combination of PCA dimensionality reduction with multiple classification approaches demonstrated that machine learning techniques can identify meaningful patterns in brain MRI data for glioma detection. Comparing the performance across classifiers provides insight into which methods are most effective for this type of medical imaging task.

Visualizations & Results

PCA biplot showing the first two principal components with loading vectors for key MRI features, revealing the dominant patterns of variation in the brain scan data.
PCA biplot showing the first two principal components with loading vectors for key MRI features, revealing the dominant patterns of variation in the brain scan data.
Sample brain MRI scans from the dataset showing both glioma tumor cases and healthy control subjects used in the analysis.
Sample brain MRI scans from the dataset showing both glioma tumor cases and healthy control subjects used in the analysis.
Classification accuracy comparison across Logistic Regression, LDA, and KNN models on the PCA-reduced feature space.
Classification accuracy comparison across Logistic Regression, LDA, and KNN models on the PCA-reduced feature space.
Hierarchical clustering dendrogram revealing natural groupings in the brain MRI data without using diagnostic labels.
Hierarchical clustering dendrogram revealing natural groupings in the brain MRI data without using diagnostic labels.

Technologies & Tools

RRStudioPCALogistic RegressionLDAKNNHierarchical Clustering