No history yet

Neural Network Fundamentals

The Brain as a Blueprint

At its core, a neural network is a computational model inspired by the human brain. It's not a literal brain in a computer, but it borrows the basic idea of interconnected nodes, or neurons, working together to process information.

Lesson image

These neurons are organized into layers. The first layer is the input layer, which receives the initial data, like the pixels of an image or the words in a sentence. The last layer is the output layer, which produces the final result, such as a prediction or a classification.

In between are one or more hidden layers. This is where the real work happens. Each neuron in a hidden layer receives signals from the neurons in the previous layer, performs a small calculation, and passes its result to the next layer. A network with multiple hidden layers is called a "deep" neural network.

Each connection between neurons has a weight, which is just a number. This weight determines the strength of the signal. The neuron adds up all the weighted signals it receives, adds another value called a bias, and then uses a special function to decide its output.

The On/Off Switch

If neurons only added up their inputs, neural networks would be nothing more than fancy calculators. They couldn't learn complex patterns. The secret ingredient that gives them their power is the activation function.

Think of an activation function as a neuron's on/off switch or a dimmer dial. After the neuron sums up its weighted inputs, the activation function processes this sum and decides what signal to send to the next layer. It introduces non-linearity into the network.

Activation Function

noun

A mathematical function that determines the output of a neuron. It introduces non-linear properties to the network, enabling it to learn complex patterns.

Without non-linearity, a neural network, no matter how many layers it has, would behave like a simple linear model. It couldn't learn intricate relationships in data, like identifying a cat in a photo or understanding the nuances of language. Activation functions allow the network to model complex, real-world data.

A common activation function is the Rectified Linear Unit, or ReLU. It's very simple: if the input is positive, it passes that value along. If the input is negative, it outputs zero. This simple rule is surprisingly effective.

Approximating Anything

So we have layers of neurons, each with a little non-linear switch. What can you build with these parts? The answer is, astonishingly, almost anything.

The Universal Approximation Theorem provides the theoretical foundation for this. It states that a neural network with just one hidden layer can, in principle, approximate any continuous function to any desired degree of accuracy, given enough neurons in that layer.

This doesn't mean it's easy to find the right weights and biases to do so. That's what the training process is for. But the theorem guarantees that the capacity is there.

Imagine trying to draw a complex curve using only short, straight lines. If you use enough tiny lines, you can create a shape that is almost indistinguishable from the original curve. A neural network works similarly, using its neurons and activation functions as the building blocks to approximate the complex function that maps your inputs to your outputs.

Information Flow

Neural networks can be categorized by how information flows through them. The two main types are feedforward and feedback networks.

A feedforward neural network is the most common type. Information travels in one direction: from the input layer, through the hidden layers, to the output layer. There are no loops. When you give it an input, it processes it and produces an output. It has no memory of past inputs.

Lesson image

A feedback neural network, also known as a recurrent neural network (RNN), is different. It has loops. The connections between neurons can form a cycle, allowing information to persist. This gives the network a form of memory.

This makes them well-suited for tasks involving sequences, like understanding sentences, predicting stock prices, or analyzing DNA. Each new input is processed in the context of the inputs that came before it.

Lesson image

While feedforward networks map a single input to a single output, recurrent networks can map an entire sequence of inputs to a sequence of outputs.

Let's check your understanding of these fundamental concepts.

Quiz Questions 1/5

What is the primary role of the hidden layers in a neural network?

Quiz Questions 2/5

The secret ingredient that allows neural networks to learn complex, non-linear patterns is the ________.

These building blocks, from individual neurons to the overall architecture, form the foundation upon which more complex systems like Large Language Models are built.