top of page

Overview

What are neural networks?

A neural network makes decisions similar to how the human brain makes decisions. The network makes layers of nodes that talk to each other with each node having a specific weight and threshold. By allowing the processes to work together to weigh options, the algorithm can draw conclusions and cluster data at high velocity.

sample neural network visual

Example Neural Network

​

This photo of a neural network on the left takes in an image, passes it through a set number of hidden layers, and then produces a result that identifies the photo of a cat.

​

By using nodes that ask binary-style questions like does this animal have whiskers? Does this animal have a tail? Each question can be given weights of importance in identifying an animal. Whiskers would be at a higher weight due to it being less common in animals while tails are more common.

​

Once a network is created, the model is trained and should be evaluated for accuracy using a cost function. The goal is to minimize the cost function to ensure that the model makes correct decisions to reduce errors but not suffer from being computationally expensive to execute. 

​

Here is a helpful video on the key concepts of neural networks being used to analyze a drugs efficacy in patients.

​

Information sourced from IBM

Data Prep

The data set that will be used for a neural network analysis will be the Kaggle Migraine data set. The Initial cleaning has been completed, check out the EDA tab for more information. There was some additional cleaning done removing non-numerical columns and changing the order of the columns to have vomiting at the end of the list. Additionally, the column names were removed from the file. A new copy of this updated data set has been uploaded into the GitHub repository and the button above links to it too.

​

For the neural network analysis, the portion of data prep needed is splitting it into a training set and a test data set. To ensure that this algorithm runs properly, we must satisfy the assumption that features are conditionally independent and do not exist in the other set. If the neural networks are given the same data for both training and testing then the algorithm hasn't done it's job in being able to identify anything new.

training data

Training Data Set: contains 80% of the data

testing data

Testing Data Set: contains 20% of the data

Code & Results

For the neural network analysis, it will be coded in Python.

​

The general structure of the neural net created is:

neural network specs

So how did the neural network do?

Honestly, not great! The model as a whole did not identify vomiting cases correctly often. It was rare if it got it correct. 

epoch scores
confusion matrix results

The maximum accuracy the model got up to was about 82% on a previous run, but the model with the most correctly identified results only had an accuracy of about 74%. The model correctly predicted 22 no-vomiting cases and 8 vomiting cases. It predicted 50 vomiting cases when no vomiting was indicated. Rerunning the process in a fresh environment would yield different results, but this is the best result received in terms of correctness.

Conclusion

Where this model struggled the most was the correct identification of vomiting based on the symptoms provided. It identified quite a few cases that should have had vomiting based on the numbers provided as inputs like the severity of pain, vertigo, light sensitivity, etc. While it used cases that had vomiting indicated, those numbers were similar to other cases where vomiting wasn't listed. If this were to be redone, the model definitely could have used more training data. The dataset was pretty small and was only learning on 320 records. Additionally, there should have been more investigation into the vomiting cases and the symptoms presented vs the non-vomiting and symptoms presented. This data set was heavily skewed for non-vomiting. So, it is understandable as to why there were so many false positives due to the numbers being presented. It was taking those few vomiting cases and then trying to make sense out of similar numbers.

​

Intuitively, it would make sense that if a person was suffering from light sensitivity, vertigo, and nausea that vomiting would instinctively follow. HOWEVER, a person who has been suffering for years from chronic migraines knows what their triggers are and how to combat the nausea. Just because there was no evidence of vomiting presenting, doesn't mean that it's always the case. One migraine may cause vomiting, one may not. There are also anti-nausea medications that can be taken prior to getting to the point of vomiting which also could skew the results. The best case scenario going forward for this data set and future research into migraines would be to have an individual document all of these symptoms for all migraines, not just as a general case.

© 2027 by Bridget Litostansky

bottom of page