Build garageTry it → read → next · ~10 min

Tutorials · Chapter D (4/4) · ~10 min

Deep learning

Try it → see it → read → next

Stack neural layers so simple signals can become useful learned representations.

Try yourself

Playground

Layer stack

Deep nets stack features: Edges → Shapes → Objects. Freeze early layers and watch later ones adapt.

  1. EdgesLow-level lines & contrast
  2. ShapesCorners, blobs, parts
  3. ObjectsCats, signs, faces

Recap

What you just did

LayerStackViewer stacked Edges → Shapes → Objects and froze early layers. Depth builds representations; freezing shows what transfer means.

Teach

How it works

A tiny forward pass can be written without a framework:

def relu(value):
    return max(0, value)

x1, x2 = 0.8, 0.3
h1 = relu(1.2 * x1 - 0.5 * x2)
h2 = relu(-0.4 * x1 + 1.1 * x2)
output = 0.7 * h1 + 0.9 * h2
print(output)

Training repeatedly runs two directions:

  1. Forward pass computes a prediction layer by layer
  2. Loss measures the prediction error
  3. Backpropagation assigns credit or blame to weights
  4. Optimizer nudges weights and repeats

Mental model: each layer is a lens; training adjusts every lens until the final picture helps the task.

Use it

When you'd use this

  • Learning patterns from images, audio, and text
  • Modeling relationships too complex for one simple rule
  • Reusing a pretrained network and fine-tuning it

Watch out

Watch out

Deep models need substantial data, compute, and evaluation. More layers do not automatically improve a small tabular problem. They can also fail opaquely, so compare against a simple baseline before celebrating complexity.

Try next

Try this next

Set one hidden activation to zero and recompute the output. Describe how information from that path disappeared.