Introduction to Neural Networks
Introduction to Neural Networks and Deep Learning
Artificial intelligence has developed through a sequence of increasingly powerful approaches. The central goal has remained consistent: giving computers abilities that ordinarily require human cognition, such as recognizing objects, making decisions, interpreting medical information, playing games, or generating language. The major change has been how computers are taught to perform these tasks.
The Evolution of Artificial Intelligence
The field of artificial intelligence, or AI, was formally established in 1956 when researchers gathered to define the field. Early researchers believed that human intelligence might be reproduced in computers relatively quickly. In practice, AI proved much more difficult than expected because human intelligence involves many abilities that people use automatically and cannot easily explain.
The development of AI can be viewed through four major stages:
- Traditional, rule-based AI
- Machine learning
- Deep learning
- Generative AI
Each stage addressed limitations in the previous one.
Traditional Rule-Based AI
The traditional approach attempted to reproduce human decision-making by writing explicit rules. A programmer would consult an expert, record the expert’s reasoning as a collection of rules, and enter those rules into a computer.
For example, a chess system might contain rules such as:
- If the board has a particular arrangement, move a certain piece.
- If an opponent threatens a specific piece, respond with a particular move.
A medical system might similarly use rules from a cardiologist:
- If an ECG has certain characteristics, identify a possible condition.
- If a patient has a particular combination of symptoms, recommend a diagnosis.
This approach is often called a rule-based or symbolic approach because knowledge is represented explicitly through symbols and logical statements.
Why Rule-Based AI Was Limited
The first difficulty is the enormous number of possible situations. A system designed for the real world encounters combinations of circumstances that were not included in its original rule set. It may perform correctly for familiar cases but fail when it encounters an unusual case.
This is a problem of generalization. Generalization is the ability to apply what has been learned to new situations. Rule-based systems tend to be brittle: a small difference between a known case and a new case can cause the system to fail.
The second difficulty is that human experts cannot provide rules for every possibility. Even experts cannot anticipate every edge case, unusual circumstance, or interaction among conditions.
The third difficulty is known as Polanyi’s paradox:
People often know how to perform a task without being able to fully explain how they perform it.
For example, a person can usually distinguish a dog from a cat almost immediately. However, that person may not be able to describe every visual feature and mental process used to make the judgment. The explanation offered afterward may not accurately describe what the brain actually did.
This creates a major obstacle for rule-based AI. If a person cannot completely articulate the reasoning process, a programmer cannot simply translate that reasoning into a complete set of computer instructions.
The issue is not merely that writing rules takes time. Computers can process large numbers of rules quickly. The deeper problem is that the rules are incomplete and do not generalize reliably to the endless variety of real-world situations.
Rule-based AI failed to become broadly successful because human knowledge is difficult to express completely as explicit rules, and explicit rules are usually too brittle to handle new situations.
Think About It
A person may recognize a familiar face immediately but struggle to list every feature used in recognition. This illustrates why performing a task and explaining the task are not always the same ability.
Machine Learning: Learning from Examples
Machine learning changed the basic strategy. Instead of explicitly programming every rule, a system receives examples of inputs and desired outputs. It then uses statistical techniques to learn a mapping from inputs to outputs.
Examples include:
- A chess position paired with a recommended next move
- Patient information paired with a later cardiac outcome
- An ECG paired with a diagnosis
- A loan applicant’s characteristics paired with whether the loan was repaid
The system attempts to learn a function that connects the input to the output. Rather than being told every rule, the model infers patterns from data.
A useful informal definition is:
Machine learning is the use of statistical techniques to learn from input-output examples.
Machine Learning Includes Many Methods
Neural networks are only one type of machine-learning model. Other methods include familiar statistical techniques such as:
- Linear regression
- Logistic regression
- Other classification and prediction methods
Linear regression itself can be considered machine learning when it is used to learn a relationship from data.
Machine learning has become widely successful because it can discover useful patterns without requiring a human to write every decision rule.
Structured and Unstructured Data
Machine-learning systems traditionally work most easily with structured data. Structured data can be arranged in rows and columns, much like a spreadsheet.
For example, a medical dataset might include columns for:
- Age
- Smoking status
- Exercise status
- Other patient characteristics
- Whether the patient later experienced a cardiac event
Numerical variables already contain numbers. Categorical variables, such as “yes” or “no,” can be converted into numerical form using techniques such as one-hot encoding. Once the variables are numerical, they can be placed into a table and supplied to a machine-learning algorithm.
Unstructured Data
Unstructured data does not naturally arrive as a meaningful table of features. Important examples include:
- Images
- Audio
- Video
- Text
A digital color image is represented computationally using three tables of numbers. These tables correspond to the amounts of red, green, and blue light at different pixel locations. Each value typically lies between 0 and 255.
A value such as 251 tells the computer that a particular location contains a large amount of one color component. However, the value does not explain what caused that color. The color could come from:
- The sky
- Water
- Paint
- An object
- Part of an animal
The numerical pixel value describes the image at a raw level, but it does not intrinsically identify the meaningful object in the image.
This is the central challenge of unstructured data: the raw numerical representation does not directly correspond to the concepts that matter for prediction.
Feature Engineering and Representation
To use traditional machine learning with unstructured data, researchers historically performed feature engineering, also called feature extraction. They manually transformed the raw input into meaningful features.
For example, a bird-classification system might receive an image and extract features such as:
- Beak length
- Wingspan
- Primary color
- Other measurable visual properties
The image is thereby converted into a structured table of features. This conversion is called a representation.
A representation is a form of data that makes the important characteristics of the underlying object more accessible to a learning algorithm. Instead of asking a model to reason directly from millions of raw pixel values, a researcher might give it a small set of features that describe the object in a more useful way.
Historically, researchers spent substantial time designing representations for specific problems. A computer-vision researcher might spend years developing a representation that allows a classifier to determine whether a medical scan contains evidence of a particular kind of stroke.
Once a useful representation had been created, a relatively simple model such as linear regression or logistic regression could often solve the prediction task. Consequently, the main challenge was frequently not the final classifier but the design of the representation.
The Human Bottleneck
Manual feature engineering created a serious limitation. It required human experts to understand the problem, identify useful features, measure or extract those features, and repeat the process for each new application.
This produced two major restrictions:
- It required significant human effort.
- The resulting representation was often designed for one particular task and did not transfer easily to other tasks.
Deep learning addresses this bottleneck by learning representations automatically.
Think About It
A raw photograph contains millions of numerical values, but a person may describe it using a few meaningful ideas such as “bird,” “long beak,” or “blue wings.” Representation learning is the process of discovering useful intermediate descriptions from raw data.
Deep Learning
Deep learning is a category within machine learning. Its defining feature is that it can learn useful representations from raw input data without requiring extensive manual feature engineering beforehand.
A deep-learning system can accept:
- Structured numerical data
- Images
- Text
- Audio
- Other forms of input
The system learns intermediate transformations that convert the raw input into increasingly useful representations. The final representation is then used to produce an output, often through a linear or logistic regression-like operation.
A simplified deep-learning pipeline is:
- Raw input enters the system.
- Several intermediate layers transform the input.
- The system automatically learns useful representations.
- A final layer produces a prediction or classification.
The key word is automatically. The system is not merely using a representation designed by a human; it is learning the representation as part of the training process.
Deep learning therefore removes much of the human bottleneck that limited traditional machine learning on images, text, audio, and other unstructured inputs.
Why Deep Learning Became Powerful
The success of deep learning resulted from the convergence of three major forces:
- New algorithmic ideas
- Large quantities of data
- Parallel computing hardware, especially graphics processing units, or GPUs
GPUs were originally designed to perform many graphical calculations simultaneously. Their ability to carry out large numbers of parallel mathematical operations also makes them useful for training neural networks.
These developments were applied to an older computational idea: neural networks. Deep learning is largely the result of using neural networks with sufficient data, computing power, and modern training methods.
Applications of Deep Learning
The ability to analyze unstructured data creates an important general pattern:
A sensor produces raw data, and a deep-learning system can be placed behind the sensor to detect, recognize, classify, analyze, or predict.
A camera produces images or video. A microphone produces audio. Other sensors produce different types of measurements. Deep learning can transform these raw signals into useful interpretations.
Examples include:
- Face ID: A camera acts as the sensor, and a deep-learning system determines whether the observed face matches the authorized user.
- Medical imaging: A deep-learning model can analyze mammograms and identify patterns associated with breast cancer.
- Self-driving systems: Multiple models can detect pedestrians, traffic lights, crosswalks, and other objects.
- Manufacturing inspection: Cameras and models can identify dents, scratches, and other defects.
- Smart binoculars: A camera can identify the bird being viewed and provide the species immediately.
The broader application idea is to look at ordinary objects and ask whether a sensor can be connected to a deep-learning system that adds a useful capability.
Data Quality and Ground Truth
A model’s performance depends heavily on the quality of its training data. Training data should be:
- Complete
- Comprehensive
- Correctly labeled
In medical imaging, the input might be a mammogram, while the label indicates whether a human expert judged that the image showed a problem. This input-label pairing is called ground truth.
Ground truth is not necessarily perfect. Human experts can make mistakes, and some labels may be noisy. For example, a medical image may initially be labeled as normal by a radiologist even though a later system identifies an early sign of disease.
Neural networks can often perform reasonably well despite some noise in the labels, but substantial errors or incomplete data will reduce model quality. Human verification remains important, especially in high-stakes settings.
Embodied Intelligence
Embodied intelligence refers to intelligent systems that operate in the physical world, such as robots. A robot must perceive its surroundings, interpret sensor inputs, and act in response.
Although robotics may require additional topics beyond basic neural networks, deep-learning techniques provide fundamental building blocks for modern robotic systems.
From Predicting Numbers to Generating Data
Traditional machine learning has commonly been used to produce structured outputs, such as one number or a small collection of numbers.
Examples include:
- The probability that a borrower will repay a loan
- The expected demand for a product next week
- The probability that an image belongs to each of several categories
- GPS coordinates for a vehicle
For a classification problem with ten possible categories, a model might produce ten probabilities that sum to 1. For another task, such as predicting coordinates, the outputs may be several numbers that do not need to sum to 1.
These are relatively simple outputs because they consist of a small number of numerical values.
Generative AI
Generative AI extends deep learning by producing unstructured data. Instead of merely consuming an image, text passage, or sound recording, the system can create new content.
Generative systems can produce:
- Images
- Text
- Music
- Audio
- Other unstructured outputs
Generative AI is therefore a subset of deep learning. It uses deep-learning methods, but deep learning includes many applications that do not generate content, such as image classification, medical diagnosis, and defect detection.
Examples of transformations include:
- Text to text, as in a conversational language model
- Text to image
- Text to music
- Image to text, such as generating a caption
- A detailed description to a corresponding image
Multimodal Models
A multimodal model can work with more than one type of data. For example, it may accept both an image and text and produce text in response.
Modern systems can combine inputs in different modalities, such as:
- Text
- Images
- Audio
- Other forms of information
A model might analyze a complicated parking sign together with a question about whether parking is allowed at a particular time. It can interpret the image, combine it with the question, and produce an answer.
However, generative systems can produce incorrect information, sometimes called hallucinations. A user should verify important answers rather than treating a model’s output as automatically reliable.
The overall progression can therefore be understood as an expansion in both directions:
- Deep learning made it easier to map unstructured inputs to useful outputs.
- Generative AI made it possible to produce unstructured outputs.
- Multimodal systems increasingly connect many input and output types within the same model.
In principle, a deep-learning system can learn a mapping from many kinds of input to many kinds of output, provided that sufficient data and suitable training methods are available.
Think About It
A traditional classifier might answer “which bird species is this?” A generative model might instead write a description of the bird, create an image of it, or answer a question about the image. The difference lies primarily in the kind of output being produced.
Neural Networks as Computational Graphs
The basic neural-network idea can be understood by rewriting a familiar model—logistic regression—as a network of mathematical operations.
Logistic Regression
Logistic regression accepts a vector of numerical inputs and produces a probability between 0 and 1.
First, the inputs are combined through a linear function. For inputs x1,x2,…,xk, the linear part can be written as:
z=b+w1x1+w2x2+⋯+wkxkThe resulting value z is then passed through the sigmoid function:
σ(z)=1+e−z1The sigmoid converts any real-valued input into a number between 0 and 1, which can be interpreted as a probability.
For example, consider a model using:
- GPA
- Years of work experience
The output indicates whether a graduate is likely to receive an interview. If the fitted model is:
z=0.4+0.2(GPA)+0.5(experience)then 0.4 is the intercept, 0.2 is the GPA coefficient, and 0.5 is the experience coefficient.
For a graduate with a GPA of 3.8 and 1.2 years of experience:
z=0.4+0.2(3.8)+0.5(1.2) z=1.76The predicted probability is:
σ(1.76)=1+e−1.761≈0.85The model therefore estimates approximately an 85% probability of receiving an interview.
Logistic Regression Terminology in Neural Networks
Neural networks use different names for familiar regression quantities:
- A regression coefficient is called a weight.
- A regression intercept is called a bias.
Thus, the logistic-regression equation can be viewed as a small network:
- Each input enters an input node.
- Each input is multiplied by a weight.
- The weighted inputs and bias are added.
- The result is passed through a sigmoid.
- A probability is produced.
The network diagram does not change the mathematics. It simply makes the flow of operations easier to see and provides a structure into which intermediate computations can be inserted.
Why Add Hidden Layers?
Logistic regression maps the inputs directly to the output. A neural network adds intermediate transformations between the input and output.
These intermediate components can learn representations of the input. Instead of manually converting an image into features such as beak length or color, the network can learn useful intermediate features on its own.
Each intermediate transformation provides another opportunity to reorganize the information. A large input vector may first be transformed into a smaller collection of numbers, then transformed again, and then passed to the output layer.
For example, an input containing k numerical values might be transformed into three intermediate values. The exact number of intermediate values is a design choice that affects the model’s capacity.
The important point is that the model does not need to preserve the original form of the input at every stage. It can create progressively different representations that make the final task easier.
Linear Transformations Alone Are Not Enough
A network could insert many linear functions between the input and output. However, stacking linear functions without nonlinear operations does not provide the desired expressive power.
The reason is that a composition of linear transformations is still equivalent to a single linear transformation. For example, if one linear operation is followed by another, the combined result can be represented as one larger linear operation. Adding many such operations would therefore create complexity in appearance but not in mathematical capability.
Nonlinear activation functions prevent this collapse. They allow the network to represent relationships that cannot be represented by one simple linear function.
A neural network layer typically performs two operations:
- A weighted sum plus a bias
- A nonlinear activation function applied to that result
A node, or neuron, receives one or more numbers, performs this computation, and produces one number.
A neuron is a mathematical unit that combines inputs through a weighted linear function and then applies a nonlinear activation function.
Think About It
If every layer performed only linear operations, the entire network could be simplified into one linear operation. Nonlinear activations are what allow multiple layers to create genuinely more complex functions.
Neural-Network Terminology
A neural network is organized into layers.
Input, Hidden, and Output Layers
The input layer represents the input variables. It may be called a layer even though its main role is to hold or receive the input values.
The output layer produces the final result. Its form depends on the task:
- A probability output may use a sigmoid.
- Multiple class probabilities may use a softmax.
- Other tasks may require other output forms.
A hidden layer is any layer between the input and output. It is called hidden because its internal values are not the final predictions and are not directly supplied as labels.
A network with many hidden layers is called a deep neural network. Deep learning is therefore associated with neural networks that contain many layers of transformations.
Fully Connected or Dense Layers
A layer is fully connected, or dense, when every neuron in one layer sends its output to every neuron in the next layer.
Suppose one layer produces three numbers. In a fully connected next layer, each of those three numbers is supplied to every neuron in the next layer. Each receiving neuron then forms its own weighted combination.
Dense connections allow every neuron in the next layer to use information from every neuron in the preceding layer.
Logistic Regression as a Neural Network
Logistic regression can be viewed as a neural network with no hidden layers:
- The input variables connect directly to the output.
- The weighted inputs and bias are combined.
- A sigmoid produces the probability.
This makes logistic regression one of the simplest possible neural networks.
Feedforward Networks and Architecture
A feedforward neural network sends information in one direction, from the input layer through hidden layers to the output layer. Information does not loop backward through recurrent connections in this basic structure.
The arrangement of the following elements is called the network’s architecture:
- Number of layers
- Number of neurons in each layer
- Connections among neurons
- Activation functions
- Output structure
Different architectures are designed for different types of tasks. Examples include:
- Feedforward networks
- Convolutional neural networks for computer vision
- Transformer networks for modern language and multimodal systems
A transformer is not separate from neural networks; it is a particular neural-network architecture.
Activation Functions
An activation function receives one number and produces one number. It is applied after a neuron computes its weighted sum and bias.
Sigmoid Activation
The sigmoid activation function is:
σ(a)=1+e−a1It maps very negative values close to 0 and very positive values close to 1. Its most significant changes occur around the middle of its range.
The sigmoid is especially appropriate for a final output that represents a single probability between 0 and 1.
For example:
- A value near 0 indicates a low predicted probability.
- A value near 1 indicates a high predicted probability.
- Values in the middle represent intermediate confidence.
Linear Activation
A linear activation simply passes its input through unchanged:
f(a)=aIt does not introduce nonlinearity. Because of this, repeatedly using linear activations would not give a network the expressive benefits associated with deep learning.
ReLU Activation
The rectified linear unit, usually called ReLU, is defined as:
ReLU(a)=max(0,a)Its behavior is simple:
- If a is positive, ReLU outputs a unchanged.
- If a is negative, ReLU outputs 0.
ReLU is widely used in hidden layers because it introduces nonlinearity while remaining computationally simple. It has become one of the central activation functions in deep learning and is often used as a default for intermediate layers.
Other activation functions include:
- Hyperbolic tangent, or tanh
- Leaky ReLU
- GELU
- Swish
In practice, ReLU is often a strong default for hidden layers. The output activation is chosen according to the type of output required.
Choosing an Output Activation
The output task determines the final activation function.
- For one probability between 0 and 1, use a sigmoid.
- For several class probabilities that must sum to 1, use a softmax.
- For other numerical outputs, a different activation may be appropriate.
The hidden-layer activation can often be selected using practical defaults and empirical experience, but the output activation must match the meaning and mathematical constraints of the desired output.
Designing a Neural Network
For a given task, the input and output are generally fixed by the problem.
For the interview example:
- The input consists of GPA and work experience.
- The output is one probability between 0 and 1.
The designer chooses much of what happens in between:
- Number of hidden layers
- Number of neurons in each hidden layer
- Hidden-layer activation functions
- Connection pattern
- Output-layer activation, subject to the output requirement
For a simple first network, the design might include:
- Two input variables
- One hidden layer
- Three hidden neurons
- ReLU activations in the hidden layer
- A sigmoid activation in the output layer
The designer determines the architecture, but the network learns the numerical values of the weights and biases during training.
Neural Architecture Search
There is also a field called neural architecture search, or NAS. It attempts to explore different network architectures automatically and identify effective designs using optimization methods.
However, a typical network is not changed from one number of layers to another during each pass through the training data. The architecture is generally selected before training. Techniques such as dropout can randomly remove some neurons during particular training passes, but dropout does not usually change the fundamental number of layers.
Dropout is used as a regularization technique to reduce overfitting. It encourages the network not to depend too heavily on a small set of neurons.
Parameters: Weights and Biases
The numerical values learned by a neural network are called its parameters. These include weights and biases.
Consider a network with:
- Two input variables
- Three neurons in one hidden layer
- One output neuron
The connections from the two inputs to the three hidden neurons require:
2×3=6weights.
The three hidden neurons connect to the one output neuron, requiring:
3×1=3additional weights.
The total number of weights is therefore:
6+3=9There is one bias for each of the three hidden neurons and one bias for the output neuron:
3+1=4The total number of parameters is:
9+4=13The biases are easy to overlook, but they are essential. They allow each neuron to shift its activation behavior rather than being forced to respond only according to a weighted sum that passes through zero.
Forward Propagation Through a Network
Once the weights and biases have been learned, the network can make predictions through a process called a forward pass, or forward propagation.
Suppose the input variables are x1 and x2. Each hidden neuron computes a weighted sum and applies ReLU:
a1=ReLU(w11x1+w21x2+b1) a2=ReLU(w12x1+w22x2+b2) a3=ReLU(w13x1+w23x2+b3)The three hidden outputs are then combined at the output neuron:
z=v1a1+v2a2+v3a3+boutFinally, the sigmoid converts the result into a probability:
y=σ(z)=1+e−z1The data flows from left to right:
inputs→hidden transformations→output probabilityThis process is called forward propagation because information is propagated forward through the network.
The network can still have only two input variables and one output variable, yet the relationship between them can be much more complicated than the direct logistic-regression relationship. The hidden layer creates nonlinear transformations that allow the model to represent more complex patterns.
How Training Determines the Parameters
The weights and biases are not manually selected one at a time. During training, the network uses:
- Training data
- A loss function
- An optimization algorithm
The loss function measures prediction error. The optimization algorithm adjusts the weights and biases to reduce that error. Gradient descent is one of the central optimization ideas used for this purpose.
The architecture determines the structure and capacity of the network. Training determines the parameter values inside that structure.
This distinction is fundamental:
- The designer chooses the architecture.
- The training process learns the weights and biases.
Explainability
A neural network’s computations are not mysterious in the sense of being unknowable. For a given input, the exact sequence of mathematical operations can be calculated. The difficulty is explaining why a particular input feature deserves a particular amount of credit for the final prediction.
In a simple logistic-regression model, it may be relatively easy to inspect individual coefficients. In a deep network, information is repeatedly transformed and combined across many layers. The original features become entangled within intermediate representations.
Therefore, the network can be computed precisely, while still being difficult to interpret in human terms. This is the central challenge of neural-network explainability and interpretability.
Comprehensive Review
Artificial intelligence began with attempts to reproduce human reasoning explicitly through rules. That approach struggled because real-world situations are too numerous and variable to enumerate, and because people often cannot explain the processes underlying their own intelligent behavior.
Machine learning replaced explicit rule writing with learning from input-output examples. It works especially naturally with structured data arranged in numerical rows and columns. When the input is unstructured, such as an image, the raw numerical representation does not directly express meaningful concepts. Traditional systems therefore depended on manually engineered features and representations, creating a major human bottleneck.
Deep learning removed much of this bottleneck by using neural networks to learn representations automatically from raw data. Its success emerged from the combination of algorithms, data, and parallel computing hardware such as GPUs. Deep learning can analyze images, audio, text, and other sensor data, enabling applications such as face recognition, medical imaging, autonomous driving, manufacturing inspection, and intelligent binoculars.
Generative AI is a subset of deep learning that produces unstructured outputs such as text, images, music, and audio. Multimodal models extend this capability by accepting and combining several kinds of input and output, including text and images. These systems are powerful but can still produce incorrect results, so important outputs require verification.
Mathematically, a neural network can be understood as a sequence of operations. Each neuron computes a weighted sum, adds a bias, and applies a nonlinear activation function. Layers organize neurons, dense layers connect each neuron to every neuron in the next layer, and hidden layers learn intermediate representations. Logistic regression is equivalent to a neural network with no hidden layers, while deep learning uses neural networks with many layers.
The sigmoid function is useful for a single probability output, while ReLU is a common default for hidden layers:
ReLU(a)=max(0,a)Nonlinear activations are essential because stacking linear operations alone would still produce only a linear transformation. The network architecture is chosen by the designer, while training uses a loss function and optimization algorithm to learn the weights and biases. Once trained, the network makes predictions by propagating inputs forward through its layers, transforming raw information into increasingly useful representations before producing the final output.

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