Introduction to Neural Networks
Introduction to Neural Networks and Deep Learning
1. The Evolution of Artificial Intelligence
Artificial intelligence originated as a formal field in 1956, when researchers gathered at Dartmouth College to define and study the possibility of creating intelligent machines. Important contributors included:
Marvin Minsky, who later founded the MIT AI Laboratory.
John McCarthy, who invented the programming language LISP.
Claude Shannon, whose work established information theory.
The early researchers were highly optimistic and believed that artificial intelligence might be largely solved within a short period. In practice, AI proved substantially more difficult because human intelligence involves perception, reasoning, learning, and adaptation that are difficult to express explicitly.
The development of AI can be understood through several major breakthroughs:
Traditional rule-based AI
Machine learning
Deep learning
Generative AI
Each breakthrough addressed limitations of the preceding approach.
2. Traditional Rule-Based Artificial Intelligence
Definition of Artificial Intelligence
Artificial intelligence is the ability to give computers capabilities that are normally associated with human cognitive activities, such as thinking, recognizing patterns, making decisions, and solving problems.
The traditional approach attempted to reproduce human behavior by explicitly programming the rules used by human experts.
How Rule-Based AI Worked
To create a computer system that played chess, developers might:
Interview chess grandmasters.
Ask how they respond to different board positions.
Convert their explanations into explicit rules.
Program rules such as:
If the board is in position A, make move B.
If a particular threat is present, respond with move C.
A medical system might be created similarly. Cardiologists could explain how they interpret an ECG, and developers would convert those explanations into a collection of if–then rules.
The resulting system would apply the stored rules to new inputs.
Why Rule-Based AI Was Not Pervasively Successful
Rule-based systems worked in some narrow, controlled domains, but they failed to generalize effectively to the complexity of the real world.
2.1 Brittleness and Poor Generalization
A rule-based system only knows the situations explicitly included in its rules. Real-world environments contain:
An extremely large number of possible situations.
Unusual or unexpected cases.
Edge cases and corner cases.
Situations that differ slightly from the examples used to create the rules.
Because the rules describe only a limited sample of possible circumstances, the system is brittle. It may perform well on familiar inputs but fail when presented with something novel.
The central issue was not primarily computational speed. Faster computers can reduce the time required to evaluate rules, but they cannot create rules for situations that developers never anticipated.
2.2 Polanyi’s Paradox
Polanyi’s paradox states that people know more than they can explicitly explain.
Humans can often perform tasks quickly without being able to describe the precise mental process involved. For example, a person can usually distinguish a dog from a cat almost immediately, but may be unable to explain exactly how the brain made that determination.
A person might offer explanations such as:
“The animal has whiskers.”
“The shape of the face looks feline.”
“The ears look like a dog’s.”
However, these explanations may be incomplete or may not correspond to the actual processes used by the brain.
This creates a fundamental problem for rule-based AI:
If humans cannot articulate how they perform a task, they cannot provide a complete set of rules for it.
Even an apparently complete explanation may not accurately describe the underlying decision process.
Subtle perception and recognition tasks involve many features that people process unconsciously.
Rule-based AI therefore struggled with tasks involving perception, recognition, and flexible adaptation.
3. Machine Learning
Machine learning arose as an alternative to explicitly programming every rule.
Definition
Machine learning uses statistical techniques to learn a mapping from inputs to outputs based on examples.
Instead of telling a computer exactly what to do, developers provide examples such as:
Chess board position → next move.
ECG measurements → diagnosis.
Patient characteristics and symptoms → future cardiac event.
Loan applicant information → probability of repayment.
The machine learning system uses these examples to estimate a function that maps an input to an appropriate output.
Machine Learning Includes Many Methods
Neural networks are only one category of machine learning. Other approaches include:
Linear regression.
Logistic regression.
Decision trees.
Other statistical and predictive modeling techniques.
Linear regression and logistic regression are therefore examples of machine learning, even though they are much simpler than modern deep neural networks.
Machine learning has become widely adopted because it can learn useful patterns without requiring developers to manually write every decision rule. In everyday discussions, the term AI often refers to machine learning because “AI” is a broader and more appealing label.
4. Structured and Unstructured Data
Machine learning originally worked most effectively when the input data was structured.
4.1 Structured Data
Structured data is data that can be organized into rows and columns, with each column representing a measurable or categorical feature.
For example, a patient dataset might include:
Age.
Smoking status.
Exercise habits.
Blood pressure.
Medical history.
Other symptoms or characteristics.
Whether the patient experienced a cardiac event in the following year.
Structured data is convenient for traditional machine learning because each observation can be represented as a vector of values.
Variables may be:
Numerical, such as age or blood pressure.
Categorical, such as smoking status coded as yes or no.
Categorical variables can usually be converted into numerical form using techniques such as one-hot encoding.
Once the data is represented numerically, models such as linear regression or logistic regression can process it directly.
4.2 Unstructured Data
Unstructured data does not naturally appear as a spreadsheet of meaningful features.
Examples include:
Images.
Video.
Audio.
Text.
Sensor streams.
An image is technically represented inside a computer using numbers, but those numbers do not directly correspond to meaningful concepts such as “beak,” “wing,” “sky,” or “bird species.”
Digital Representation of Images
A color image can be represented using three numerical tables, or channels:
A red channel.
A green channel.
A blue channel.
Each location in the image is a pixel. A channel value generally ranges from 0 to 255 and represents the amount of that color’s light at that pixel.
For example, a blue-channel value of 251 indicates a large amount of blue light at a particular location. However, that value does not reveal what caused the blue appearance. The blue area might be:
The sky.
Water.
Blue paint.
Clothing.
Another object.
Therefore, the raw numerical value has little intrinsic connection to the real-world object or concept being represented.
5. Feature Engineering and Representation
Traditional machine learning usually required developers to transform raw unstructured data into meaningful features.
Feature Engineering
Feature engineering is the manual process of extracting informative features from raw data so that a machine learning model can use it.
For a bird-classification system, a developer might manually measure or identify:
Beak length.
Wingspan.
Body size.
Primary color.
Feather patterns.
Shape of the head.
Other physical characteristics.
The image is thereby converted into a structured representation that can be placed into a spreadsheet.
Representation
Representation is the form in which raw data is converted into features that expose useful information about the underlying object or phenomenon.
The raw image is one representation. A table containing beak length, wingspan, and color is another representation.
Representation was central to traditional machine learning because the success of the final classifier often depended more on the quality of the representation than on the choice between simple predictive models.
Human Bottleneck
Historically, researchers spent substantial time developing representations manually. For example, a computer vision researcher might spend years designing features that allow a model to detect evidence of a particular kind of stroke in CAT scans.
Once the representation was developed, a conventional model such as linear regression or logistic regression could often perform the final prediction.
This created a major limitation:
Developing representations was labor-intensive.
Representations were often designed for one specific task.
A representation suitable for one medical condition might not work for another.
The approach limited the number of problems that could practically be addressed.
The manual creation of representations was therefore a human bottleneck.
6. Deep Learning
Definition
Deep learning is a subfield of machine learning in which models automatically learn useful representations from raw input data.
Deep learning removes the need to manually construct all the relevant features in advance.
A typical deep learning pipeline is:
Raw input enters the system.
Multiple intermediate layers transform the input.
The model automatically learns increasingly useful representations.
A final linear or logistic regression-style component produces the output.
Deep learning can work with:
Structured numerical data.
Images.
Text.
Audio.
Video.
Other forms of unstructured data.
The key word is automatically. The system learns which transformations and representations are useful from the training examples.
Why Deep Learning Was Transformative
Deep learning greatly expanded the reach of machine learning by eliminating much of the manual feature-engineering process. The model can learn internal features that developers did not explicitly specify.
This basic idea has supported major systems and applications such as:
ChatGPT.
AlphaGo.
AlphaFold.
Image-recognition systems.
Medical-imaging systems.
Autonomous vehicles.
Deep learning’s power comes from the ability to perform many successive transformations of the input, allowing the model to discover complex patterns.
Three Forces Behind Deep Learning’s Success
The modern success of deep learning resulted from the convergence of three major developments:
New algorithmic ideas
Improved methods for training neural networks.
More effective activation functions and optimization techniques.
Large quantities of data
Neural networks generally require many examples to learn complex patterns.
More data provides greater opportunity to identify reliable relationships.
Parallel computing hardware
Graphics processing units, or GPUs, can perform many numerical operations simultaneously.
This makes training large neural networks substantially more practical.
These forces were applied to the older idea of neural networks, producing modern deep learning.
7. Deep Learning and Sensors
A major consequence of deep learning is that almost any sensor can be connected to a system that detects, recognizes, classifies, analyzes, or predicts what the sensor observes.
Sensors as Sources of Unstructured Data
A sensor collects information from the world:
A camera collects images or video.
A microphone collects audio.
Other sensors collect signals, measurements, or environmental data.
Deep learning can be placed behind the sensor to interpret the raw data.
The resulting system can:
Detect objects.
Recognize events.
Classify observations.
Count objects.
Analyze conditions.
Make predictions.
Applications
Face Recognition
A smartphone’s camera acts as the sensor for Face ID. A deep learning system analyzes the captured image and classifies whether it matches the authorized user.
Medical Imaging
Deep learning can analyze mammograms to detect possible breast cancer. In some cases, the system may identify patterns that were not recognized by a human radiologist.
This illustrates that deep learning can detect subtle signals in medical images, including evidence that may have been too faint or complex for earlier evaluation methods.
Autonomous Vehicles
Self-driving systems use many deep learning components, including systems for:
Pedestrian detection.
Traffic-light detection.
Stop-sign detection.
Zebra-crossing detection.
Road and vehicle recognition.
Manufacturing Inspection
Cameras can inspect products for defects such as:
Dents.
Scratches.
Surface irregularities.
Missing or incorrectly placed components.
Deep learning systems can classify whether a product passes inspection or requires further review.
Smart Binoculars
A smart binocular system can use a camera and deep learning model to identify a bird while the user is viewing it. This demonstrates a broader product-design principle:
A useful way to identify new applications is to look for a sensor and ask whether a deep learning system can be placed behind it to interpret the sensor’s output.
Such a capability may create a short-term competitive advantage, although technology-based advantages are rarely permanent because competitors can often imitate successful features.
8. From Predictive AI to Generative AI
Deep learning initially made it much easier to process unstructured inputs. However, traditional predictive models generally produced relatively simple outputs.
Traditional Outputs
Traditional machine learning can predict:
A single number.
A probability.
Several numerical values.
A category.
A vector of probabilities.
Examples include:
The probability that a loan applicant will repay a loan.
Product demand for the following week.
The probability of each furniture category in an image.
GPS coordinates for a vehicle.
Whether a medical image shows a particular condition.
These are relatively structured outputs because they consist of a small number of values.
Generative AI
Generative AI is the ability of a model to create unstructured data such as text, images, music, or audio.
Generative AI is contained within deep learning. It is not synonymous with deep learning:
All generative AI systems use deep learning.
Not all deep learning systems are generative.
Many deep learning applications perform classification, detection, or prediction without generating new content.
Examples of Generative Tasks
Generative systems can perform mappings such as:
Text → text.
Text → image.
Text → music.
Text → audio.
Image → text.
Image and text → text.
Text and image → image or text.
ChatGPT is an example of a text-to-text generative system.
Multimodal Models
Modern generative systems increasingly accept and produce multiple types of data.
Multimodal models process combinations of modalities such as text, images, audio, and video.
A multimodal model might receive:
A written question.
An image.
A sequence containing alternating text and images.
It can then produce a textual or visual response.
For example, a model could analyze a complicated parking sign, combine the sign’s visual information with the user’s stated date and time, and answer whether parking is allowed.
However, generative systems can produce incorrect information, often called hallucinations. Their outputs should therefore be checked, especially when an error could create legal, financial, medical, or safety consequences.
The broader trend is that formerly separate capabilities—text-to-text, text-to-image, text-to-music, and others—are increasingly being combined within unified multimodal systems.
9. Training Data, Labels, and Ground Truth
A model’s performance depends heavily on the quality of its training data.
Requirements for Useful Training Data
Training data should be:
Complete, covering relevant cases.
Comprehensive, representing the range of conditions encountered in practice.
Correctly labeled, with outputs that accurately reflect reality.
If the data is incomplete or systematically misleading, the model may learn the wrong relationships.
Ground Truth
Ground truth is the input-and-label combination treated as the correct answer for training or evaluation.
In medical imaging, for example:
The input may be a mammogram.
A human radiologist or group of radiologists provides the label.
The image and label together form the ground truth used to train the model.
Ground truth is not automatically perfect. Human experts can make mistakes, and labels can be wrong in a small percentage of cases.
Noisy Labels
A noisy label is a training label that does not accurately represent the true condition.
Neural networks can often perform reasonably well even when a limited amount of label noise exists. Nevertheless, excessive or systematic errors in the labels can significantly reduce model quality.
Medical examples are especially difficult because early signs of a disease may be subtle. A historical image may have been labeled “normal” by a radiologist even though a later diagnosis indicates that an early abnormality was already present. This creates a potentially incorrect training label.
10. Embodied Intelligence
Embodied intelligence refers to intelligence implemented in a physical system, such as a robot, that must operate in the real world.
Robotics was not covered in depth, but deep learning forms a fundamental component of modern robotic systems. Robots use learned models to:
Perceive their surroundings.
Recognize objects.
Plan actions.
Interpret sensor data.
Interact with the physical environment.
The central distinction is that an embodied system does not merely process information; it must use that information to act in the world.
11. Learning a Mapping from Anything to Anything
Modern deep learning systems can learn mappings in which both the input X and output Y may take many forms.
Examples include:
Structured data → numerical prediction.
Image → category.
Image → caption.
Text → image.
Text → music.
Text and image → answer.
A sequence of text and images → a sequence of text and images.
The general principle is:
With enough appropriate data and a sufficiently capable architecture, deep learning can learn complex mappings from many kinds of inputs to many kinds of outputs.
This ability underlies much of the excitement surrounding current AI systems.
Neural Networks
12. Logistic Regression as a Starting Point
A neural network can be understood by first examining logistic regression.
Logistic regression receives a vector of numerical inputs and produces a probability between 0 and 1.
For inputs x1,x2,…,xk, logistic regression first computes a weighted linear combination:
It then applies the sigmoid function:
The final output is:
Because the sigmoid maps any real-valued input to a value between 0 and 1, the result can be interpreted as a probability.
Example: Interview Prediction
Suppose the inputs are:
GPA.
Years of work experience.
The binary output is:
0: the graduate is not called for an interview.
1: the graduate is called for an interview.
A fitted logistic regression model might have:
Intercept: 0.4.
GPA coefficient: 0.2.
Experience coefficient: 0.5.
The resulting model is:
For a person with GPA 3.8 and experience of 1.2 years, the linear component is:
This produces a probability after applying the sigmoid function.
13. Representing Logistic Regression as a Network
The logistic regression equation can be represented as a network of mathematical operations.
Components
Input nodes receive values such as GPA and experience.
Each input travels along an arrow.
Each arrow multiplies its input by a coefficient.
A summation node adds the weighted inputs and the intercept.
The resulting number is passed to a sigmoid node.
The sigmoid produces the final probability.
The information flows from left to right.
This graphical representation is mathematically equivalent to the original logistic regression equation. Its value becomes clearer when intermediate layers are added.
Neural Network Terminology for Regression Parameters
In ordinary regression terminology:
A coefficient is the multiplier associated with an input.
The intercept is the constant term.
In neural network terminology:
A coefficient is called a weight.
An intercept is called a bias.
Thus, the linear operation is usually written as:
Once all weights, biases, and the network architecture are known, the model can be reconstructed.
14. Hidden Layers and Learned Representations
The key advantage of writing a model as a network is that it allows intermediate computations to be inserted between the inputs and final output.
A simple logistic regression model performs:
A linear transformation.
A final output transformation.
A neural network adds one or more intermediate layers that transform the input before the final prediction.
Intermediate Transformations
Suppose the input contains k numbers. An intermediate layer can combine those inputs into a smaller set of values. For example:
The original input may contain 1,000 values.
A hidden layer may transform them into three values.
Further layers may repeatedly transform those three values.
Each intermediate transformation provides the network with another opportunity to learn a useful representation.
The network does not receive explicit instructions such as “calculate beak length” or “identify the wings.” Instead, it learns internal representations that help minimize prediction error.
Why Nonlinearity Is Necessary
If a network contained only linear transformations, stacking many layers would not provide meaningful additional power. Multiple linear operations can be combined into one equivalent linear operation.
For example, applying one linear transformation after another still produces a linear transformation. Therefore, a deep stack of linear layers would collapse mathematically into a single linear mapping.
Nonlinear functions must be inserted between linear transformations. These functions allow the network to represent complex relationships that cannot be captured by a single linear function.
15. Neurons, Layers, and Network Architecture
Neuron
A neuron receives one or more numbers, applies a linear function, passes the result through a nonlinear activation function, and produces one number.
A neuron may receive many inputs but produces only one output.
A simplified neuron can be written as:
where:
xi are input values.
wi are weights.
b is a bias.
f is the activation function.
a is the neuron’s output.
The name “neuron” is loosely inspired by biological neurons, but the relationship between artificial neural networks and biological neuroscience is limited and debated. Practical deep learning systems are primarily mathematical and computational models.
Layers
A layer is a collection of neurons operating at the same stage of the network.
Common layer types include:
Input layer: receives the original input. It is called a layer even though it may not perform a transformation.
Hidden layer: an intermediate layer between the input and output.
Output layer: produces the final result.
Fully Connected or Dense Layer
A fully connected, or dense, layer connects every neuron in one layer to every neuron in the next layer.
If one layer has three neurons and the next layer has four neurons, each of the three outputs is sent to all four neurons in the following layer.
Dense layers provide a straightforward way for every feature learned in one layer to influence every neuron in the next layer.
Feedforward Neural Network
A feedforward neural network sends information in one direction, from the input layer through hidden layers to the output layer.
There are no loops that send information backward through earlier layers during the forward computation.
Deep Learning and Depth
Deep learning generally refers to neural networks with many layers.
The number of layers gives a network its depth. More layers provide more opportunities to transform the input and learn hierarchical representations.
Architecture
The architecture of a neural network is the arrangement of its layers, neurons, connections, activation functions, and other structural components.
Examples of neural network architectures include:
Feedforward neural networks.
Convolutional neural networks for computer vision.
Transformer networks for language and multimodal tasks.
Recurrent neural networks, although transformers have become more common for many modern applications.
A transformer is not separate from neural networks; it is one particular neural network architecture.
16. Activation Functions
An activation function receives one scalar value and returns one scalar value. It is applied after a neuron computes its weighted sum.
Activation functions introduce nonlinearity into the network.
16.1 Sigmoid Activation
The sigmoid function is:
Its output lies between 0 and 1.
Properties:
Very negative inputs produce values close to 0.
Very positive inputs produce values close to 1.
The most substantial change occurs around the middle of the curve.
It is commonly used in a binary classification output layer when the desired output is a probability.
16.2 Linear Activation
A linear activation simply passes its input through unchanged:
It does not introduce nonlinearity. Consequently, repeatedly stacking linear activations does not give a network the expressive power of a nonlinear network.
16.3 Rectified Linear Unit
The rectified linear unit, commonly called ReLU, outputs the input if it is positive and outputs zero if it is negative.
Its mathematical definition is:
Equivalently:
ReLU is widely used in hidden layers because:
It is computationally simple.
It introduces nonlinearity.
Negative values are set to zero.
Positive values pass through unchanged.
It has been strongly associated with the practical success of modern deep learning.
For hidden layers, ReLU is often an effective default choice.
Other Activation Functions
Other commonly used activations include:
Hyperbolic tangent, or
tanh.Leaky ReLU.
GELU.
Swish.
These alternatives modify the shape or behavior of ReLU-like functions and may be advantageous in particular architectures. However, ReLU is often sufficient for practical hidden-layer applications.
Choosing the Output Activation
The output requirements determine the activation function in the final layer.
Binary probability: use a sigmoid, producing one value between 0 and 1.
Multiple mutually exclusive classes: use softmax, producing probabilities that sum to 1.
Other numerical outputs: use an activation appropriate to the required output range and meaning.
Hidden layers: ReLU is a common default.
The output activation cannot be chosen independently of the prediction task.
17. Designing a Neural Network
For a particular prediction problem:
The input layer is determined by the available input data.
The output layer is determined by the desired output.
The hidden structure is designed by the model developer.
The designer chooses:
Number of hidden layers.
Number of neurons in each hidden layer.
Activation functions in hidden layers.
Connections between layers.
Other architectural features.
The output layer must be compatible with the type of prediction required.
Neural Architecture Search
Neural architecture search, or NAS, is a field that attempts to find effective network architectures automatically.
A NAS system may explore:
Different numbers of layers.
Different numbers of neurons.
Different connection patterns.
Different activation functions.
It can use optimization techniques, and sometimes reinforcement learning, to identify architectures that work well for a particular problem.
However, a standard training process does not usually change the number of layers from one pass through the training data to the next. The architecture is generally selected before ordinary parameter training begins.
Dropout
Dropout is a regularization technique that randomly removes or disables selected neurons during training.
Its purpose is to reduce overfitting, in which a model memorizes details of the training data instead of learning patterns that generalize to new data.
During different training passes, different neurons may be dropped out. This creates a form of variation in the internal computation without changing the network’s permanent architecture.
18. Learning Weights and Biases
The weights and biases are not normally selected manually.
Training uses:
A collection of input-output examples.
A loss function measuring prediction error.
An optimization algorithm.
Repeated adjustments to weights and biases.
The objective is to minimize the loss:
The network gradually adjusts its parameters so that its predictions become more accurate on the training data and, ideally, on unseen data.
The central computational process involves gradient-based optimization, including gradient descent, which determines how parameter values should change to reduce the loss.
19. Neural Network Example: Interview Classification
Consider a deep neural network with:
Two inputs:
x1: GPA.
x2: work experience.
One hidden layer.
Three hidden neurons.
ReLU activations in the hidden layer.
One sigmoid output neuron.
The structure is:
Hidden-Layer Computation
The three hidden neurons produce activations such as:
The output neuron then computes:
The result y^ is the predicted probability that the person will be called for an interview.
Counting Parameters
The network has:
Weights from the input to the hidden layer
There are two inputs connected to each of three hidden neurons:
Biases in the hidden layer
Each of the three hidden neurons has one bias:
Weights from the hidden layer to the output
The three hidden activations connect to one output neuron:
Bias in the output layer
The output neuron has one bias:
Total
The total number of trainable parameters is therefore 13.
A common mistake is to count only the connection weights and forget the biases. Both weights and biases must be included.
20. Neural Networks and Explainability
A neural network’s computation is deterministic for a fixed input and set of parameters. The exact path of values through the network can be calculated.
The difficulty is not knowing what the network computes. The difficulty is explaining the contribution of individual input features.
For example, a neural network may predict that a loan applicant will repay a loan, but it may be difficult to state clearly:
How much GPA contributed.
How much experience contributed.
Whether an interaction between the two mattered.
Which intermediate representation caused the final result.
The input features become combined and transformed across many layers. This makes it difficult to assign responsibility to any one attribute.
This challenge is known as explainability or interpretability.
21. Important Summary Relationships
The relationship among the major concepts can be expressed as follows:
Traditional AI: humans explicitly write rules.
Machine learning: models learn mappings from structured input-output examples.
Deep learning: neural networks learn representations automatically, allowing them to process raw unstructured data.
Generative AI: deep learning systems generate unstructured outputs.
Multimodal AI: models process and generate multiple kinds of data within a single system.
A neural network is fundamentally a sequence of transformations:
The inputs and outputs are determined by the task, while the hidden layers, neuron counts, and hidden-layer activation functions are design choices. Training then learns the weights and biases that make the network’s predictions useful.

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