
How do neural networks essentially work? Let’s use the Titanic dataset as an example to walk through the basic workflow of a neural network. The Titanic dataset holds passenger information for 2224 individuals on the RMS Titanic which sank in 1912 killing 1502 passengers. Age, fare, passenger class, survival, and other features are included in this data set. We want to build a neural network that will predict the likelihood a passenger will survive or not based on their features such as age, passenger class etc. We use these features (Input X) to predict survival (Predictions Y’). After some initial data cleaning and preparation, we add layers which transform the data and map the inputs to the output predictions. The connections at each layer change to learn the data and best map the passengers’ features to the likelihood of their survival or not. These connections go through many iterations to improve the accuracy of the model’s predictions by using a loss function which produces a score which is fed to an optimizer that adjusts the weights or parameters at each layer. The objective is to minimize the loss score as much as possible to find the optimal weights that provide the best connections between the input features, layers, and output predictions. Think of it like tuning a piano where pressing the keys (Input X) produces a sound and based on our skill at identifying the correct tune, we adjust the piano (Weights) to improve the connection between the pressing of the key and the correct tone (Prediction/Output) as best as possible. In this case, the loss score is the individuals’ own ability to determine the correct tone and the optimizer is the tool/technique he/she uses to fix it. Eventually the neural networks learns and develops the optimal connections to maximize the predictive accuracy of survival.