Skip to content

Handouts

Full class walkthroughs, as single-page documents and as notebooks to run. Each one renders every figure from the actual data, ships the code to reproduce it, and includes solved exercises.

They complement the class pages rather than replace them: each goes deep on one topic and works both as a companion during class and as a reference afterwards.

Written in Portuguese

The handouts are course material for the in-person classes and are written in Brazilian Portuguese. The code, the library names and the figures are language-independent.

  • Exploratory Data Analysis


    California Housing — 20,640 districts from the 1990 Census.

    Integrity audit, univariate analysis for numeric and categorical variables, all three pairings (numeric × numeric, categorical × numeric, categorical × categorical), multivariate and geospatial analysis. Includes an interactive skewness/kurtosis simulator.

    ~3 h · 19 figures · 10 exercises

    open · class

  • Normalization and Transformation


    Titanic — 891 passengers, 866 missing values.

    Missing data and the MCAR / MAR / MNAR mechanisms, a decision diagram of techniques by variable type, scaling, shape transformation, categorical encoding, and leakage measured across four scenarios.

    ~3 h · 10 figures · seven-checkpoint exercise

    open · class

  • Dimensionality Reduction


    Iris and MNIST — from 4 dimensions to 784.

    PCA from two derivations, how to choose k, reconstruction and interpretation. Where PCA fails on non-linear manifolds, then t-SNE and UMAP: what each one preserves, what each one distorts, and a decision rule for choosing between them. Appendix on the curse of dimensionality.

    ~3 h · 12 live simulators · eight-step Iris lab + 5 MNIST tasks

    open · class

  • From EDA to Dimensionality Reduction


    Palmer Penguins — 344 penguins, 6 input columns, 19 missing values from two causes.

    An in-class lab that runs the whole path end to end: univariate then bivariate analysis, a train/test split before any transformation, a pipeline that handles missing values and scaling without leaking, and the same data projected by PCA, t-SNE and UMAP — compared under a single criterion, then applied to unseen points.

    Colab notebook · 8 steps, each ending in a check value

    open in Colab · class

  • Clustering


    Iris and synthetic data — make_blobs, make_moons and a random baseline.

    Why grouping is a choice rather than a discovery, the algorithm and the inertia it chases, and silhouette point by point — both metrics worked by hand on eight points before any library. Then choosing k with the two of them together, across five lab steps.

    50 min class + 70 min lab · 12 questions · Colab with 3 exercises

    handout · Colab · class


    Extra — challenge

    178 wines, self-guided with the answer key held back to the end: five scalings, four indices plus a gap statistic written from scratch, stability, GMM with BIC, and clustering in reduced space — then audit every decision against the key.

    open the challenge

  • Linear Regression


    Galton's 928 families — plus a five-point set small enough to do by hand.

    Where the word "regression" comes from and why the effect is not a force; least squares worked on paper; residual diagnostics; and the derivation of ∂J/∂w that turns the closed form into gradient descent. Ends by measuring why centring the data changes convergence but not the fit.

    70 min class + 70 min lab · 4 simulators · 10 questions

    handout · class


    Extra — in depth

    Projection and orthogonality, the normal equations derived, least squares as maximum likelihood, the hat matrix, leverage and Cook's distance, confidence versus prediction bands, multicollinearity seen as a cloud of estimates, and the Gauss–Markov small print.

    open the deep dive

  • Linear Regression from Scratch


    Five points — small enough that every number can be checked on paper.

    One path, no detour: write ŷ = Xw, try to invert X and watch the attempt fail while running, arrive at the normal equations, then measure where they break. The scale cell shows what actually stops the closed form in high dimension — not the O(d³) time, but the memory of XᵀX, which at 100k features is 80 GB and never gets built. Ends with gradient descent written by hand, reaching the same vector to 10⁻¹⁵.

    Colab notebook · 13 runnable cells · 5 exercises

    open in Colab · class


    For home — Python that runs in the page

    Denser, and interactive without installing anything: nine Python cells execute inside the page itself through Pyodide. Standard library only — transpose, matrix product and Gaussian elimination are written out, since hiding the algebra behind a matrix call would contradict the point. Closes with eight multiple-choice questions with worked answers.

    open the home handout

  • Gradient Descent in Practice


    Three points and 20,640 houses — the same three points as the class table, then California housing.

    Picks up where the from-scratch notebook stops: a one-variable slope, the learning rate pushed until it diverges and the (1 − 2η) factor that explains why, the class's one-step table reproduced number by number, and the loss landscape with and without centring. Then one-line vectorized gradient on real data — exploding without standardization, reaching the least-squares answer in ~20 iterations with it — and mini-batch.

    Colab notebook · 17 runnable cells · 4 "bet before you run" stops · 5 exercises

    open in Colab · class

Classroom use

Each handout has an anchored sidebar index, a copy button on every code block, and its own print stylesheet — the menu, buttons and interactive elements are dropped when printing or exporting to PDF.