1. Home
  2. Explore
  3. Computer Science
  4. Introduction to Neural Networks

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Neural Networks

Speaker 1Speaker 2

Introduction to Neural Networks

16:23
0:00-16:23
  1. Anna

    Welcome to today's episode on neural networks and deep learning. We'll begin with the larger story of artificial intelligence, then move into what neural networks are, how they work, and why they became so powerful.

  2. Simon

    Let's start with the history. The field of AI is generally traced to 1956, when researchers gathered at Dartmouth and formally defined the field. MIT was strongly represented by Marvin Minsky, who founded the MIT AI Lab, John McCarthy, who invented LISP, and Claude Shannon, a professor at MIT who founded information theory.

  3. Anna

    And the early optimism was extraordinary. These researchers thought AI might be substantially solved by that fall. That prediction clearly did not come true, but over the decades the field has gone through several major breakthroughs: traditional, rule-based AI; machine learning; deep learning; and, most recently, generative AI.

  4. Simon

    Traditional AI began with a very intuitive idea: if we want a computer to perform a human cognitive task, we should ask an expert how they do it and write down the rules. For chess, you might ask grandmasters which move to make in different board positions. For medical diagnosis, you might ask a cardiologist to describe how they interpret an ECG, then encode the answers as if-then rules.

  5. Anna

    That approach did work in a few areas, so why wasn't it broadly successful? One problem is that a collection of rules is brittle. The real world contains an effectively unlimited number of situations, including edge cases and corner cases, while the system is trained on only a small sample of possible situations.

  6. Simon

    The key issue isn't simply that writing rules takes time. Faster computers can reduce the time required to run through rules. The deeper issue is generalization: a system built from explicit rules often cannot handle a new situation that wasn't anticipated by its designers.

  7. Anna

    There's also a more fundamental problem known as Polanyi's paradox: we know more than we can tell. Show a person a picture and ask whether it contains a dog or a cat, and they can often answer almost instantly. But asking them to explain exactly how they recognized it produces incomplete or possibly inaccurate explanations, because their verbal account may not match what their brain actually did.

  8. Simon

    So if humans cannot fully articulate the rules they use, it is difficult to put those rules into a computer. That combination of unspoken knowledge and endless edge cases made traditional rule-based AI very limited.

  9. Anna

    Machine learning changed the strategy. Instead of explicitly telling the computer what to do, we provide many examples of inputs and outputs. For example, we could show chess positions and the next moves, or ECG data and diagnoses, then use statistical techniques to learn a mapping from input to output.

  10. Simon

    Machine learning is therefore a broad term for learning from input-output examples using statistical methods. Neural networks are only one kind of machine learning. Linear regression, for example, is also machine learning, and there are many other methods as well.

  11. Anna

    Machine learning has had enormous impact, and when people casually say AI today, they are often really talking about machine learning. But traditional machine learning works especially well when the input is structured: data that can be represented numerically in the rows and columns of a spreadsheet.

  12. Simon

    Imagine a patient dataset with age, smoking status, exercise habits, symptoms, and whether the patient later experienced a cardiac event. Numerical variables can be entered directly, while categorical variables such as yes or no can be converted into numbers using techniques such as one-hot encoding.

  13. Anna

    Unstructured data is much harder. A digital image is represented by tables of numbers, with values describing the amount of red, green, and blue light at each pixel, usually on a scale from 0 to 255. But a value such as 251 for blue light does not tell you whether that blue came from sky, water, or paint. The raw number has little intrinsic connection to the object being described.

  14. Simon

    That is why traditional machine learning needed feature engineering, also called feature extraction. If we wanted to classify bird species from photographs, we might manually measure beak length, wingspan, primary color, and other characteristics, then put those measurements into a spreadsheet.

  15. Anna

    This process is called creating a representation: taking raw data and expressing it in a form that a learning algorithm can use. Historically, researchers often spent years developing excellent representations for one specific task, such as detecting evidence of a particular stroke in CAT scans. Once the representation existed, conventional linear or logistic regression could classify the cases.

  16. Simon

    But manual representation-building became a major human bottleneck. It required substantial expertise and limited how widely machine learning could be applied, especially to images, audio, and other unstructured inputs.

  17. Anna

    Deep learning addresses that bottleneck. Deep learning is part of machine learning, but it can take unstructured inputs and automatically learn useful representations from the raw data, without requiring people to engineer every feature in advance.

  18. Simon

    A simple way to picture the pipeline is this: raw data enters, several stages in the middle learn representations automatically, and the resulting information is passed to a final linear or logistic regression model. The inputs and outputs may stay the same, but the system learns increasingly useful transformations in between.

  19. Anna

    The impact of that idea has been remarkable. Deep learning underlies systems such as ChatGPT, AlphaGo, and AlphaFold. Its success came from the combination of new algorithmic ideas, large amounts of data, and parallel computing hardware such as GPUs, applied to the older idea of neural networks.

  20. Simon

    One immediate application is image classification, but the broader implication is even more important: deep learning can be attached to almost any sensor. A camera produces unstructured images or video, and a microphone produces unstructured audio. Put a deep learning system behind a sensor, and the system can detect, recognize, classify, count, analyze, and predict what that sensor observes.

  21. Anna

    Examples include Face ID, where an iPhone camera works with a deep learning system to determine whether the face matches its owner; mammogram analysis for breast cancer detection; self-driving systems that detect pedestrians, traffic lights, and zebra crossings; and manufacturing systems that identify dents or scratches through cameras.

  22. Simon

    The bird-identifying smart binoculars illustrate the product opportunity. The binoculars use a sensor to observe a bird and a deep learning system to identify its species. The larger lesson is to look around and ask: where are the sensors, and could a useful deep learning capability be attached behind one?

  23. Anna

    The lecture also emphasized that data quality matters, particularly for medical systems. Training data should be complete and comprehensive, and its labels should be correct. In medical imaging, the image and the human radiologist's judgment about whether there is a problem form the ground truth used for training.

  24. Simon

    Those labels can still be wrong some of the time. In the breast cancer example, an earlier mammogram had been judged normal by a radiologist, but a later deep learning system identified an issue that had not been recognized then. Neural networks can tolerate some label noise and still perform well, but human verification and careful data construction remain important.

  25. Anna

    Deep learning also changed what systems can produce. Earlier machine learning could predict a number, a few numbers, or probabilities—for example, the probability that someone repays a loan, next week's product demand, a furniture category, or GPS coordinates. These are structured outputs.

  26. Simon

    Generative AI extends deep learning so that systems can create unstructured outputs such as images, text, music, and audio. It sits within deep learning rather than replacing it: generative AI is one type of deep learning, while many deep learning applications have nothing to do with generation.

  27. Anna

    Generative systems can map text to text, as in ChatGPT; text to images; text to music; or captions to images. They are also becoming multimodal, meaning they can accept combinations of text and images and produce text or images in response.

  28. Simon

    A useful example is asking a system to interpret a complicated parking sign from a photograph. Given the image and the fact that it is Wednesday at 4:00 PM, the system might answer that parking is allowed for up to one hour. But because these systems can hallucinate, meaning they can produce incorrect information confidently, important answers still need to be double-checked.

  29. Anna

    The overall landscape is becoming a mapping from almost anything to almost anything, including multimodal combinations, provided there is enough data. Modern robotics is an example of embodied intelligence, because robots must operate in the physical world. Robotics was outside the lecture's scope, but deep learning components are fundamental building blocks in modern robotic systems.

  30. Simon

    Now let's connect this big picture to the basic mechanics. Logistic regression takes a vector of input numbers, computes a linear function, and passes the result through the sigmoid function, one divided by one plus e to the power of negative that result. The sigmoid converts the value into a number between zero and one, which can be interpreted as a probability.

  31. Anna

    Suppose the inputs are GPA and years of work experience, and the output indicates whether a graduate is called for an interview. A fitted logistic regression model might have an intercept of 0.4, a GPA coefficient of 0.2, and an experience coefficient of 0.5. The linear part is 0.4 plus 0.2 times GPA plus 0.5 times experience, and the result then goes through the sigmoid.

  32. Simon

    We can draw that calculation as a network. GPA and experience are input nodes. Each input travels along an arrow and is multiplied by its coefficient, while the intercept enters separately. A node adds those values, and the resulting single number passes through the sigmoid to produce the interview probability.

  33. Anna

    For someone with a GPA of 3.8 and 1.2 years of experience, the linear calculation gives 1.76, and applying the sigmoid gives approximately 0.85. So the model assigns that person an estimated 0.85 probability of being called for an interview.

  34. Simon

    Neural networks use different names for familiar regression terms. Coefficients are called weights, and the intercept is called a bias. Once the architecture and these weights and biases are known, the model can be reconstructed.

  35. Anna

    The reason for drawing logistic regression as a network is that it reveals the possibility of adding operations in the middle. Instead of sending inputs directly to the output, we can transform them repeatedly. Those intermediate transformations are where the network can learn representations.

  36. Simon

    The simplest intermediate operation is a linear function. Several input numbers can be combined into one number, or into several numbers using several linear functions. For example, a thousand input values might be transformed into three values. Those three values form a new representation of the original input.

  37. Anna

    However, stacking only linear functions would not provide enough expressive power, because a sequence of linear transformations can itself be reduced to a single linear transformation. To make the network substantially more flexible, we insert nonlinear functions between the linear operations.

  38. Simon

    A linear function followed by a nonlinear function is called a neuron. A neuron can receive many numbers but produces one number. That output may then be sent to multiple neurons in the next layer.

  39. Anna

    The vertical collection of neurons is called a layer. The input is called the input layer, the final stage is the output layer, and the layers in between are hidden layers. When every neuron in one layer connects to every neuron in the next layer, the layer is called fully connected or dense.

  40. Simon

    Logistic regression can therefore be viewed as a neural network with no hidden layers. Deep learning is neural-network learning with many layers. A network whose information simply flows from left to right is called a feedforward neural network.

  41. Anna

    The arrangement of neurons, layers, connections, and activation functions is the network's architecture. Convolutional neural networks and transformers are examples of particular architectures. ResNet is another well-known architecture; it became famous for surpassing human-level performance in image classification.

  42. Simon

    Let's return to activation functions. An activation function receives one number and produces one number. The sigmoid is one example: it maps very negative inputs close to zero and very positive inputs close to one, with most of its change occurring in the middle.

  43. Anna

    A linear activation simply passes the number through unchanged. The most important hidden-layer choice in this introduction is the rectified linear unit, or ReLU. ReLU is the maximum of the input and zero: positive values pass through unchanged, while negative values become zero.

  44. Simon

    ReLU is simple, but many deep learning researchers regard its use as one important factor in the field's success. Other activation functions include tanh, leaky ReLU, GELU, and swish. As a practical default for hidden layers, ReLU generally works very well.

  45. Anna

    The output activation depends on the required output. Use a sigmoid when the output is a probability between zero and one. If the output consists of several probabilities that must add up to one, use softmax. So hidden-layer activations are often chosen by rule of thumb, while the output activation is dictated by the task.

  46. Simon

    When designing a network, the input and output are determined by the problem. The designer chooses the number of hidden layers, the number of neurons in each hidden layer, and the hidden-layer activation functions. There is also a field called neural architecture search, or NAS, that explores different architectures using optimization methods.

  47. Anna

    That is different from changing the number of layers on every pass through the training data. The architecture is normally fixed during training. However, techniques such as dropout can randomly omit some neurons during particular passes, and dropout can help prevent overfitting.

  48. Simon

    The weights and biases are not usually selected manually. Training data, a loss function, and an optimization algorithm guide the network toward values that minimize prediction error. The designer sets up the model, and the training process learns the parameters.

  49. Anna

    Consider again the interview problem. There are two inputs, GPA and experience, three ReLU neurons in one hidden layer, and one sigmoid output. The network has six weights connecting the two inputs to the three hidden neurons, three hidden-layer biases, three weights connecting the hidden neurons to the output, and one output bias.

  50. Simon

    That makes thirteen parameters in total. The common mistake is to count only the twelve connection weights and forget the bias terms. Hand-counting parameters in a small network is a useful way to check that you understand the architecture.

  51. Anna

    Once training has found the weights and biases, prediction is just a forward calculation. Each hidden neuron computes a weighted combination of GPA and experience, adds its bias, and applies ReLU. The three resulting values are combined using the output weights, the output bias is added, and the final number passes through the sigmoid.

  52. Simon

    The resulting mathematical expression can become complicated even with only two inputs and three hidden neurons. That complexity is precisely what gives the network the capacity to learn richer mappings than ordinary logistic regression.

  53. Anna

    This also explains a limitation in explainability. We know exactly how a particular input flows through the network and can calculate every intermediate value. What is difficult is assigning responsibility to one original feature, because the attributes become combined through many transformations.

  54. Simon

    So the central idea is simple: a neural network repeatedly transforms its inputs, uses nonlinear activation functions to gain expressive power, and finally produces an output through an appropriate final layer. Deep learning applies this idea with many layers and learns useful representations automatically.

  55. Anna

    And that brings the episode full circle. Traditional AI tried to write the rules explicitly. Machine learning learned mappings from structured examples. Deep learning learned representations from raw, often unstructured data, and generative AI extended the output side so systems could create unstructured and multimodal content.

  56. Simon

    The inputs and outputs can now be extremely varied, but the underlying mechanics remain grounded in layers, neurons, weights, biases, activation functions, and training. Understanding those basics is the foundation for studying more specialized architectures, including convolutional networks and transformers.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent