PDF

2 · Python and neural network foundations

2 · Python and neural network foundations#

Chapter status: outline

This is the planned scope of Chapter 2. The complete lesson, executable examples, and solutions will be developed later. Chapter 1 is available now.

Question. What changes when a regression model learns its own nonlinear features?

  • Learn: arrays, shapes, indexing, broadcasting, functions, and reproducible random generators; then tensors, automatic differentiation, minibatches, and a PyTorch training loop.

  • Statistical lens: linear/logistic regression, basis expansions, regularization, optimization, overfitting, and validation.

  • Python practice: fit logistic regression and a small multilayer perceptron to the same simulated problem; record train/validation curves and compare against a simple baseline.

  • Self-check: distinguish the model, loss, optimizer, and data split; check a derivative numerically before trusting autodiff.