ML5: Neural networks and deep learning

Lesson 1 of 5 · reading 15–25 minutes; practice and project time is on the module page

From a neuron to a network

🎯You'll be able to

Describe a neuron, a layer and an activation function, and count the parameters in a small network.

🏠The everyday picture

A factory line where each station takes the parts from the station before, combines them and passes on something more finished. Early stations make simple shapes; later ones assemble them into a product. A neural network passes numbers through layers in the same way.

📘What it really is

📝A worked example

Input: DakDost's 21 prepared inputs (14 one-hot columns and 7 scaled numbers, ML2 Lesson 3), and a small network: 21 → 32 → 16 → 1.

Steps:

  1. First layer: 21 × 32 weights + 32 biases = 704.
  2. Second layer: 32 × 16 + 16 = 528.
  3. Output: 16 × 1 + 1 = 17.

Expected output: 704 + 528 + 17 = 1,249 parameters. PyTorch confirms it with sum(p.numel() for p in model.parameters()), which printed 1249 with torch 2.15.0. The kit's gradient boosting model has far more numbers in its 200 trees, which is a reminder that "neural" doesn't mean "bigger".

🌍Where it's used

📝Case scenario

A team added three more hidden layers to a network for credit risk, expecting a better score. It trained more slowly and scored the same on validation. The data was a table of 20 columns, where boosted trees were already as good; the extra layers added nothing but cost.

🖱️Try it

Count the parameters of a network 21 → 64 → 1 by hand, then check it with code if you have PyTorch. Success: 21 × 64 + 64 + 64 + 1 = 1,473.

⚠️Common mistakes

🛠️For your project

The projects don't need a network; the assignment asks you to compare one with the kit's model and decide.

✅Quick check

What does an activation function add?

Show the answer

Bends, so the network can learn curves and combinations instead of only weighted sums.

How many parameters has a dense layer with 10 inputs and 5 neurons?

Show the answer

10 × 5 + 5 = 55.

← BackML5
ProLearners Assist