Posts

Convolutional neural network classification of brain MRI

Image
Trying to classify the patients diagnosed with Schizophrenia from their brain MRI using Convolutional Neural Network on Python will be the scope of this post. There is a possibility that the person with this mental disorder has developed certain areas of the brain, different from the others. Some studies state that in patients with schizophrenia, MR imaging shows a smaller total brain volume and enlarged ventricles. Import necessary libraries import os import zipfile import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers The code was executed on Google Colab. We will upload the files in 2 different folders on Google Drive and call them from there. from google.colab import drive drive.mount('/content/drive') The following code reads, normalizes, and resizes a 3D medical image. The code first defines three functions: read_nifti_file(): This function reads a 3D medical image from a file and returns the image data.

Three ways of splitting Train and Test in RStudio

Image
 I have put together  👌  ways of splitting the dataset before running the model.      1. ifelse Will create and attach a new column named ‘train’ to the dataset. The runif() function will generate random values from a Uniform Distribution. The number of values this funtion will generate is the number of rows of the dataset. By random it generates 0 as minimum value and 1 as the maximum. If a value generated will be smaller than 0.8, the ifelse() function will assign the value 1 to the respective row, and if is bigger than 0.8 it will assign the value 0. So, we have 80% of 1 value and 20% of 0 value. Beautiful! Creating the training set and test set from the rows that have the ‘train’ value equal to 1 and equal to 0, respectively to trainset and testset. I will need to remove the ‘train’ column from the dataset before running the prediction model, as it is needed only for the separation of the data. Finding the index of the ‘train’ column with the grep() function and after removing fro

Classification using Support Vector Machines and K-Nearest Neighbours algorithms in RStudio.

Image
Breast Cancer Classification Data Preparation A glimpse on our data The dataset used can be downloaded at: https://data.world/health/breast-cancer-wisconsin . Breast cancer is the fourth most common cause of cancer death in the UK. There are thirty-two breast cancer deaths every day according to 2017-2019 data according to Cancer Research UK. The slightly better news is that the survival rate is 78% which has improved from 40% in the past 40 years. That is due to new technology being used in the detection and treatment process. Medical procedures such as Magnetic Resonance Imaging (MRI), Mammography, and Ultrasound have been introduced. But the latest developments are coming from Machine Learning. They are widely recognized as decent contributors to breast cancer pattern classification. Moreover, they help in clinical decision-making and diagnosis. The required libraries. library(ggplot2) library(dplyr) ##