What Is a Neural Network

updated 29 Sep 2023

At its core, a Neural Network is a computational model inspired by the human brain's interconnected neurons. Comprising layers of artificial neurons, or nodes, it processes information through weighted connections, learning patterns and relationships from data. These networks excel in tasks like image recognition, language processing, and decision-making, with the ability to adapt and improve through a learning process involving adjustments to numerous parameters. Neural Networks play a pivotal role in machine learning, transforming raw input into meaningful output, making them a fundamental technology in modern artificial intelligence.

But What is a Neural Network | Chapter 1, Deep learning

Introduction Example and Series Preview

The video starts by presenting an example of the number three, emphasizing how the human brain effortlessly recognizes it despite variations in pixel values. The speaker introduces the challenge of programming a computer to recognize handwritten digits in a 28 by 28 pixel grid.

The presenter expresses the importance of understanding machine learning and neural networks, aiming to demystify them as mathematical concepts rather than buzzwords. The focus is on explaining the structure of a neural network, with the upcoming video addressing the learning aspect.

The goal is to build a neural network capable of recognizing handwritten digits, a classic example in the field. The presenter mentions sticking to a basic, plain-vanilla form of neural networks for the introductory videos, highlighting it as a prerequisite for understanding more advanced variants.

The video aims to make viewers feel motivated and informed about what it means for a neural network to "learn." It also hints at providing resources for further learning and code exploration. Additionally, the presenter mentions the existence of various neural network variants but focuses on the simplicity of the introductory material while acknowledging the complexity even in its basic form. The video concludes by acknowledging the computer's ability to recognize handwritten digits but hints at some limitations.

What Are Neurons, Introducing Layers, and Why Layers?

The video breaks down the concept of neurons in neural networks, describing them as entities that hold a number between 0 and 1. Neurons in the first layer correspond to pixels in a 28 by 28 pixel image, with each neuron holding a grayscale value. The activation of a neuron is described as a high number making it "lit up."

The video introduces layers in the neural network, with the first layer consisting of 784 neurons representing pixels, and the last layer having ten neurons representing digits. Hidden layers, represented as a question mark for understanding, come between these layers. The speaker chose two hidden layers, each with 16 neurons, for illustration purposes.

The operation of the network involves activations in one layer determining activations in the next layer. The training process involves patterns of activations causing specific patterns in subsequent layers, ultimately resulting in the network's choice of a digit for a given image.

The speaker discusses the rationale behind a layered structure, suggesting that middle layers might recognize components like loops or lines in digits. The hope is that neurons in these layers correspond to sub-components, allowing the network to piece together digits by recognizing combinations of these sub-components. The layered structure is seen as a way to break down recognition into manageable steps, even though challenges remain in recognizing and learning sub-components.

The video hints at the usefulness of detecting edges and patterns for image recognition tasks and suggests that layered structures can be beneficial for various intelligent tasks, including parsing speech.

The video concludes by posing questions about how activations in one layer determine activations in the next, emphasizing the goal of designing a mechanism that combines pixels into edges, edges into patterns, and patterns into digits. The speaker acknowledges that these are goals and hopes, leaving room for exploration and explanation in subsequent parts of the video series.

Edge Detection, Counting Weights and Biases, and How Learning Relates

The video focuses on the concept of edge detection in a neural network and explains the parameters involved in achieving this, such as weights and biases.

  1. Neuron Parameters: The speaker discusses the need for a neuron in the second layer to detect an edge in a specific region. Parameters like weights and biases are introduced to allow the network to capture pixel patterns.

  2. Weighted Sum and Activation: Weights are assigned to connections between neurons in different layers, and the weighted sum of activations from the first layer is computed. A sigmoid function is applied to the weighted sum to ensure the activation falls between 0 and 1.

  3. Sigmoid Function: The sigmoid function is explained as a way to squish the real number line into the range between 0 and 1. It is particularly useful in converting the weighted sum into an activation value for the neuron.

  4. Bias: The concept of bias is introduced to determine how high the weighted sum needs to be before a neuron becomes active. The bias is added to the weighted sum before applying the sigmoid function.

  5. Network Complexity: The video discusses the complexity of the network, noting that a hidden layer with 16 neurons connected to 784 pixels results in 13,000 total weights and biases. Each connection has its own weight and bias, contributing to the overall expressiveness of the network.

  6. Learning in Neural Networks: Learning in neural networks involves finding optimal settings for weights and biases. The speaker emphasizes the vast space of possibilities in adjusting these parameters, noting that there are almost 13,000 knobs and dials that can be tweaked to make the network behave differently.

  7. Experimentation with Weights and Biases: The video suggests the idea of manually setting weights and biases to achieve a desired outcome. While this may be a thought experiment, the speaker emphasizes the importance of understanding the meaning of these parameters to experiment and improve the network's performance.

  8. Challenging Assumptions: Examining what weights and biases are doing is presented as a way to challenge assumptions and explore the full space of possible solutions. This approach is seen as a means to go beyond treating the neural network as a black box and gaining insights into its functioning.

Linear Algebra, it's Notation, and Neural Networks

  1. Notational Compactness: The video addresses the complexity of writing down the function for neural network connections and introduces a more notationally compact representation.

  2. Vector and Matrix Representation: Activations from one layer are organized into a column vector, and weights are represented as a matrix. Each row of the matrix corresponds to connections between one layer and a specific neuron in the next layer.

  3. Matrix Vector Product: The weighted sum of activations in the first layer is described as a term in the matrix-vector product of the organized activations and weights.

  4. Importance of Linear Algebra: The speaker emphasizes that a good grasp of linear algebra is crucial for understanding machine learning, particularly neural networks. A recommendation is made to refer to a series on linear algebra, especially chapter three.

  5. Bias Representation: Instead of adding biases independently to each value, biases are organized into a vector and added to the entire matrix-vector product.

  6. Sigmoid Function Application: The video introduces the application of the sigmoid function to each specific component of the resulting vector, emphasizing its role in squishing the values between 0 and 1.

  7. Simplified Expression: The entire transition of activations from one layer to the next is communicated using a tight and neat expression involving the weight matrix, bias vector, and sigmoid function. This is seen as making the relevant code simpler and faster.

  8. Optimization through Matrix Multiplication: The efficiency of matrix multiplication is highlighted, mentioning that many libraries optimize matrix multiplication, making the relevant code faster.

Overall, the video aims to provide a more concise and efficient way of expressing neural network connections through linear algebraic notation, making code more manageable and faster.

Recap and ReLU vs Sigmoid

  1. Neurons as Functions: Neurons are described as functions that take in the outputs of all neurons in the previous layer and produce a number between zero and one. The entire network is characterized as a complex function with 13,000 parameters, involving weights, biases, matrix-vector products, and sigmoid functions.

  2. Recognition Challenge: The complexity of the neural network function is seen as reassuring, indicating its capability to take on the challenge of recognizing digits. The complexity arises from the need to learn appropriate weights and biases.

  3. Learning Process: The video hints at explaining how the network learns the appropriate weights and biases by looking at data, with the promise of delving deeper into the network's functionality in the next video.

  4. Subscription Mention: The video suggests subscribing to stay notified about upcoming videos, acknowledging the potential lack of YouTube notifications and humorously emphasizing the influence of neural networks in recommendation algorithms.

  5. Acknowledgment to Patreon Supporters: Gratitude is expressed to Patreon supporters, with a mention of progress in the probability series and a promise of updates for patrons.

  6. Closing Discussion on ReLU vs. Sigmoid: The video concludes with a discussion on activation functions, comparing the sigmoid function to the rectified linear unit (ReLU). The speaker is joined by Lisha Li, who provides insights into the historical use of sigmoid and the prevalent use of ReLU in modern networks. ReLU is noted for being easier to train and effective for deep neural networks.

  7. Acknowledgment to Lisha Li: Thanks are given to Lisha Li, who did her PhD work on the theoretical side of deep learning and works at a venture capital firm called Amplify Partners. Amplify Partners is acknowledged for providing funding for the video.