Backpropagation and Neural Networks
- 78Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What does a classifier function f take as input and produce as output?
It takes data x as input and produces a vector of scores, one for each class.
Or swipe the card
78 cards
What does a classifier function f take as input and produce as output?
It takes data x as input and produces a vector of scores, one for each class.
What is the purpose of a loss function?
It quantifies how well or poorly the classifier's scores match the desired classification outcomes.
How is the total loss L typically constructed?
It combines a data loss term with a regularization term.
Why is regularization included in a loss function?
To prefer simpler models that are more likely to generalize well.
How does gradient descent minimize a loss function?
It repeatedly updates the parameters in the direction of steepest descent, which is the negative gradient.
How do numerical and analytic gradients differ?
Numerical gradients use finite differences and are slow and approximate; analytic gradients are fast and exact once derived but require calculus and can contain implementation errors.
Why compare an analytic gradient with a numerical gradient?
To verify that the analytic-gradient implementation and its mathematical derivation are correct.
What is a computational graph?
A graph representation of a function in which nodes represent individual computation steps and edges represent values passed between steps.
How can a linear classifier and its loss be represented as a computational graph?
Nodes can compute the matrix product Wx, the data loss, the regularization term, and finally their sum to form the total loss.
What is the main advantage of representing a function as a computational graph?
It allows backpropagation to compute gradients through complex functions by combining simple local derivatives.
Why are computational graphs especially useful for deep models?
Deep models contain many transformations, making direct symbolic differentiation impractical.
For f(x,y,z)=(x+y)z, what intermediate variable can simplify the computational graph?
Define q=x+y, so that f=qz.
For f(x,y,z)=(x+y)z with x=−2, y=5, and z=−4, what are q and f?
q=3 and f=−12.
What are the local derivatives for the addition node q=x+y?
rac{\partial q}{\partial x}=1 and rac{\partial q}{\partial y}=1.
What are the local derivatives for the multiplication node f=qz?
rac{\partial f}{\partial q}=z and rac{\partial f}{\partial z}=q.
What is the forward pass in a computational graph?
The process of evaluating the graph from inputs to output, computing and often caching each intermediate value.
What is the backward pass in a computational graph?
The process of propagating gradients from the output backward through the graph using the chain rule.
What is backpropagation?
Backpropagation is a recursive application of the chain rule that computes gradients with respect to all variables in a computational graph.
What is the initial gradient at the output node during backpropagation?
The gradient of the output with respect to itself is 1.
For f=qz with q=3 and z=−4, what are rac{\partial f}{\partial z} and rac{\partial f}{\partial q}?
rac{\partial f}{\partial z}=q=3 and rac{\partial f}{\partial q}=z=-4.
For f=(x+y)z with x=−2, y=5, and z=−4, what are the gradients with respect to x, y, and z?
rac{\partial f}{\partial x}=-4, rac{\partial f}{\partial y}=-4, and rac{\partial f}{\partial z}=3.
What is an upstream gradient?
It is the gradient of the final output or loss with respect to a node's immediate output, arriving from later nodes during backpropagation.
How does a node compute the gradient with respect to one of its inputs?
It multiplies the upstream gradient by the local gradient of its output with respect to that input.
What information does an individual computational node need during backpropagation?
Its local inputs, its directly computed output, and the local derivatives of that output with respect to its inputs.
Why does backpropagation avoid deriving the gradient of an entire complex expression?
It decomposes the expression into simple operations and applies the chain rule to their local derivatives.
How are gradients handled when one variable influences multiple downstream nodes?
The gradients arriving through the different paths are added together.
What does an addition gate do to an upstream gradient?
It distributes the same upstream gradient to each input.
What does a maximum gate do to an upstream gradient?
It routes the gradient to the input that attained the maximum and sends a gradient of 0 to the other input.
What does a multiplication gate do to an upstream gradient?
It scales the upstream gradient by the value of the other input.
What is the sigmoid function?
The sigmoid function is �sigma(x)=rac{1}{1+e^{-x}}.
What is the derivative of the sigmoid function?
�sigma′(x)=�sigma(x)(1−�sigma(x)).
At what level can computational-graph nodes be defined?
At any granularity, from individual arithmetic operations to larger functions such as a sigmoid gate.
What trade-off determines how much to combine operations into a computational-graph node?
Combining operations simplifies the graph but may require deriving a more complex local gradient; separating them makes local derivatives simpler.
What is the form of the more complex example function involving weights and inputs?
f(w,x)=rac{1}{1+e^{-(w_0x_0+w_1x_1+w_2)}}.
Why are forward-pass values needed during the backward pass?
Local derivatives often depend on values computed during the forward pass, so those values must be retained or cached.
What changes when scalar variables in a computational graph become vectors?
The forward and backward procedures remain conceptually the same, but gradients become Jacobian matrices or equivalent vectorized operations.
What is a Jacobian matrix?
A matrix containing the partial derivative of each output component with respect to each input component.
For a mapping from an n-dimensional input to an m-dimensional output, what is the Jacobian's shape?
It has shape m by n.
What is the element-wise maximum operation f(x)=�max(x,0) commonly called?
It is the ReLU operation, applied element by element.
What is the size of the Jacobian for a 4096-dimensional vector mapped element-wise to another 4096-dimensional vector?
It is a 4096 by 4096 matrix, containing 40962 entries.
What structure does the Jacobian of an element-wise operation have?
It is diagonal because each output component depends only on the corresponding input component.
Why is the full Jacobian usually not explicitly computed for element-wise operations?
Its diagonal structure allows the needed gradient effects to be applied directly without constructing the enormous matrix.
For q=Wx, what is rac{�partial q_k}{�partial W_{ij}}?
rac{�partial q_k}{�partial W_{ij}} is xj when k=i and 0 otherwise.
For q=Wx, what is rac{�partial q_k}{�partial x_i}?
Wki.
For f(q)=�leftont{L2}{q} with squared form f=q12+q22, what is the gradient with respect to q?
�nablaqf=2q.
What shape should the gradient with respect to a vector or matrix variable have?
It should have the same shape as the variable itself.
How is the gradient with respect to Wij computed when q=Wx and f depends on every component of q?
rac{�partial f}{�partial W_{ij}}=�sum_krac{�partial f}{�partial q_k}rac{�partial q_k}{�partial W_{ij}}.
What is the vectorized gradient pattern for f(q)=�leftont{L2}{q} where q=Wx?
The gradient with respect to q is 2q, and the gradients with respect to W and x are obtained by chaining this upstream vector through q=Wx.
What two functions does each computational gate expose in a modular implementation?
A forward function that computes the output and a backward function that computes input gradients.
In what order should gates be processed during the forward pass?
In topologically sorted order, so all inputs to a gate are computed before the gate itself.
In what order should gates be processed during the backward pass?
In reverse topological order, starting at the output and moving toward the inputs.
What does the forward function of a multiplication gate compute?
Given inputs x and y, it computes and returns z=xy.
What does the backward function of a scalar multiplication gate compute?
Given upstream gradient dz, it returns dx=ydz and dy=xdz.
Why should a gate cache values during its forward pass?
The cached values are often needed to calculate local gradients during the backward pass.
How do deep-learning frameworks commonly represent layers?
Each layer implements a forward computation and a backward gradient computation, and networks stack these layers together.
What is the basic workflow for finding gradients of a new function using backpropagation?
Express the function as a computational graph, define intermediate variables, derive local gradients, perform a forward pass, and then apply the chain rule backward.
What is the simplest two-layer neural-network computation described in the lecture?
Apply a linear transformation W1x, a nonlinear activation such as �max(0,W1x), and then a second linear transformation W2h.
Why must nonlinearities be inserted between stacked linear layers?
Without nonlinearities, a composition of linear transformations collapses into a single linear function.
What is a neural network in functional terms?
A hierarchical composition of simpler functions, typically linear layers and nonlinear activation functions.
What is the role of the intermediate activation vector h in a two-layer network?
It contains the activated scores produced by the first layer and serves as input to the next layer.
How can hidden units improve on a single-template linear classifier?
They allow the network to detect multiple templates or modes and combine them to produce a class score.
What does the first weight matrix W1 represent in the template interpretation?
Its rows can act as templates that measure the presence of different patterns in the input.
What does the second weight matrix W2 do in the template interpretation?
It weights and combines the hidden-layer template scores to produce final class scores.
How can a network recognize different orientations of an object?
It can use separate hidden templates for different orientations and combine their activation scores in a later layer.
What is a deep neural network?
A neural network with multiple stacked layers of transformations and nonlinearities.
What is the difference between a two-layer network and a one-hidden-layer network?
They describe the same architecture: a network with two linear or fully connected layers and one hidden layer between the input and output.
What is the relationship between a three-layer network and its number of hidden layers?
A three-layer network has two hidden layers when the output layer is included in the layer count.
Why are fully connected layers often implemented with matrix multiplication?
Matrix multiplication computes the activations of an entire layer of neurons efficiently and in vectorized form.
What is the general matrix form of a feed-forward neural network?
Repeatedly apply a matrix multiplication followed by a nonlinearity, such as h1=�sigma(W1x) and h2=�sigma(W2h1), followed by an output layer.
How are gradients used after backpropagation in a neural network?
The computed parameter gradients are passed to an optimization method such as gradient descent to update the weights.
What is the biological analogy for the inputs to an artificial neuron?
They are analogous to signals received through dendrites and synaptic connections from other neurons.
What is the biological analogy for the weighted sum in an artificial neuron?
It loosely corresponds to integrating incoming signals in a neuron's cell body.
What is the biological analogy for an artificial neuron's output?
It is loosely analogous to a signal carried to downstream neurons through an axon.
How can an activation function be loosely interpreted biologically?
It can be viewed as producing an output related to a neuron's firing or spiking rate.
What is the ReLU function?
ReLU outputs zero for negative inputs and a linear value equal to the input for positive inputs: �mathrmReLU(x)=�max(0,x).
Why should biological analogies for artificial neural networks be treated cautiously?
Biological neurons are much more complex, with diverse neuron types, nonlinear dendritic computations, dynamic synapses, and signaling patterns not captured by simple artificial neurons.
Why is interpreting an activation as a simple firing rate insufficient as a biological model?
Real neurons communicate through variable spike timing and rates, so a single activation value does not capture their full signaling behavior.
What are fully connected neural networks?
They are networks whose layers perform matrix multiplications connecting units in one layer to units in the next.

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