Over 5 Key Concepts of Neural Networks Explained
Here are several key things to know about neural networks.
1. The Core Structure: Layers of Nodes
Neural networks are composed of node layers. There is an input node layer, one or more hidden layers, and an output layer. These networks reflect the behavior of the human brain, allowing computer programs to recognize patterns and solve common problems in the fields of AI and deep learning. In fact, we should be describing this as an artificial neural network, or an ANN, to distinguish it from the biological neural network operating in our heads.
2. The Neuron as a Model
Think of each node, or artificial neuron, as its own linear regression model. Linear regression is a mathematical model that's used to predict future events. The weights of the connections between the nodes determine how much influence each input has on the output.
Each node is composed of: - Input data - Weights - A bias (or threshold) - An output
3. Data Flow: The Feed-Forward Network
Data is passed from one layer in the neural network to the next in what is known as a feed-forward network.
To illustrate this, let's consider what a single node in our neural network might look like to decide if we should go surfing. The decision to go or not is our predicted outcome, known as our yhat
.
Let's assume there are three factors influencing our decision:
- Are the waves good? (x1
): The waves are pumping, so x1 = 1
(1 for yes).
- Is the lineup empty? (x2
): Unfortunately not, so that gets a 0
.
- Is it shark-free? (x3
): Yes, no shark attacks have been reported, so x3 = 1
.
Now, we assign a weight to each factor based on its importance on a scale of 1 to 5:
- Waves (w1): This is important, so we'll give it a 5
.
- Crowds (w2): Not as important, so we'll give that a 2
.
- Sharks (w3): Very important, we'll give that a score of a 4
.
We can now plug these values into the formula to get the desired output, using a bias (threshold) of 3
.
Formula:
yhat = (x1 * w1) + (x2 * w2) + (x3 * w3) - bias
Calculation:
yhat = (1 * 5) + (0 * 2) + (1 * 4) - 3
yhat = 5 + 0 + 4 - 3
yhat = 6
Since the result 6
is greater than 0, the output of this node is 1
—we're going surfing. If we adjust the weights or the threshold, we can achieve different outcomes.
4. Learning Through Training
Neural networks rely on training data to learn and improve their accuracy over time. We leverage supervised learning on labeled datasets to train the algorithm. As we train the model, we evaluate its accuracy using a "cost function."
Ultimately, the goal is to minimize our cost function to ensure the correctness of fit for any given observation. This happens as the model adjusts its weights and biases to fit the training dataset through a process known as gradient descent, allowing the model to determine the direction to take to reduce errors and minimize the cost function.
5. A Variety of Network Types
There are numerous types of neural networks beyond the feed-forward network described in this article.
For example: - Convolutional Neural Networks (CNNs): These have a unique architecture that's well-suited for identifying patterns, making them ideal for tasks like image recognition. - Recurrent Neural Networks (RNNs): Identified by their feedback loops, RNNs are primarily leveraged with time-series data to make predictions about future events, like sales forecasting.