DEV Community

Cover image for ML in Disease Prediction System
Varshaah Shashidhar
Varshaah Shashidhar

Posted on

ML in Disease Prediction System

I recently built an image-based disease predictor using machine learning. Here I am sharing my learnings and best practices through experience.

The image-based model was made of a recursive application of convolution and pooling layers, followed by inner product layers at the end of the network. CNN classifiers have recently shown their superiority over other classical classifier approaches based on feature vector classification [12, 18]. I implemented a CNN classifier to address the classification problem for the diagnosis of Alzheimer’s disease.

Mild cognitive impairment (MCI) is the prodromal stage of Alzheimer’s disease (AD). Identifying MCI subjects who are at high risk of converting to Alzheimer’s disease is crucial for effective treatments.

A deep learning approach based on convolutional neural networks (CNN), is designed to accurately predict MCI-to-AD conversion with magnetic resonance imaging (MRI). The proposed approach is validated on the standardized MRI datasets from the Alzheimer’s Disease Neuroimaging Initiative (ADNI) project. Currently, the accuracy is 79%, working towards improving it.

Data pre-processing:

I picked the dataset from Kaggle and refined it. The original dataset had 4 categories: very mildly demented, mildly demented, moderately demented, and non-demented. Since the dataset did not have enough images, I grouped the first three categories as demented. So, the model will either predict the presence or absence of dementia.

Model Building:

This model was built using the following steps:

I used transfer learning using inception v3 for image classification. When we have a relatively small dataset, a super-effective technique is to use Transfer Learning where we use a pre-trained model. This model has been trained on an extremely large dataset, and we would be able to transfer weights which were learned through hundreds of hours of training on multiple high-powered GPUs. Many such models are open-sourced such as VGG-19 and Inception-v3. They were trained on millions of images with extremely high computing power which can be very expensive to achieve from scratch.

The next step was to add new trainable layers that will turn old features into predictions on the new dataset. This is important because the pre-trained model is loaded without the final output layer.

The pre-trained model's final output will most likely be different from the output that we want for your model.

Therefore, I added some new dense layers as you please, but most importantly, a final dense layer with units corresponding to the number of outputs expected by your model.

Keras library from TensorFlow was used to train the convolutional neural network. For compiling it, binary cross-entropy was used as the loss parameter.

Then for fitting the model, I initialized 10 epochs.

Implementation Settings and Evaluation Indices:

The models and algorithms adopted in the work have been implemented, and all the experiments are conducted by using Python on a CPU + GPU platform with the CPU of Intel ®Core™ i77700@3.60 GHz and the GPU of NVIDIA GeForce GTX 1080Ti.

The dataset is divided into 3 equal parts in which 1 part is used as the testing data and 1 part is used as training data with 1 part of them as verification data. The total test set consists of 1024 images.

Now that the model was ready, the next step was to evaluate the deep learning model. One of the methods to do that is data visualization. We plotted an accuracy plot and a loss plot.

To find the accuracy of the model, we used the accuracy score as the judging parameter, followed by the confusion matrix to further support the generated accuracy score. The model turned out to be 79% accurate. When we visualized this through the confusion matrix, we found out the true positive cases were 447 while the true negative cases were 362.

Evaluation of the Proposed Method

Image description

Classification Report

Image description

Confusion Matrix

Image description

Top comments (0)