Predicting Stroke with an Neural Network


Objective: Train my own neural network using ml5.js to predict the likelihood of a stroke

I trained my neural network using Healthcare Dataset Stroke data from Kaggle. The data has 10 main columns that can serve as inputs: gender, age, hypertension, heart_disease, ever_married, work_type, Residence_type, avg_glucose_level, bmi, smoking_status. It has one column labeled “stroke” with the labeled output as 0 or 1. To train my NN model in classification mode, I needed to simplify the data and remove some columns. When I used all 10 inputs, I would get an error that my input array could not be normalized. I think the normalizeData() has an input length limit. As a result, I removed the ever_married, work_type, Residence_type, and bmi columns from the data and changed the “stroke” numerical values to “yes” or “no”. As a result, removing variables caused my loss to be higher than usual despite adjusting the epoch, batch size, and learning rate parameters. Overall this was a rewarding exercise, but cleaning the data was tedious. I hope to train the model with all 10 inputs in the future and troubleshoot the normalizeData() function.

Training visualization

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s