FREE COURSE / REAL PRACTICE
Python & empirical ML
Learn Python objects, functions and reliable data handling, then work toward numerical experiments, NumPy, PyTorch and empirical evaluation.
What you’ll work toward
Write tested Python programs and design reproducible experiments with explicit data and evaluation boundaries.
Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.
Before you start
The entry lesson has no earlier CodeRigor skill prerequisite. Start there and follow the sequence.
Individual lessons can add prerequisites. The course map shows your actual readiness.
A look inside the first lesson
scores = [1, 2]
alias = scores
alias.append(3)
print(scores) # [1, 2, 3]
alias = [9]
print(scores) # still [1, 2, 3]Your course outline
Follow the lessons in curriculum order. Open a unit to preview the ideas you’ll work with.
Python: language foundations
- LESSON 01.01
Names, objects & copying
Bindings, identity, mutable containers, shallow copies and fresh defaults; keep experiment inputs independent.
Open lesson - LESSON 01.02
Functions, control flow & contracts
Explicit returns, loops, keyword-only arguments and boundary validation for small dependable functions.
Open lesson - LESSON 01.03
Collections, grouping & deterministic order
Dictionaries, sets, comprehensions and stable sorting for experiment records and reproducible rankings.
Open lesson - LESSON 01.04
Exceptions, resources & honest failures
Narrow exception handling, context-managed streams and preserving failure information in evaluation code.
Open lesson
Python: reliable programs & data
- LESSON 02.01
Iterators, generators & streaming batches
Single-pass iterables, lazy generators and bounded-memory batches for datasets larger than memory.
Open lesson - LESSON 02.02
Typed records & validated configuration
Dataclasses, type annotations, immutable configuration and runtime checks at untrusted boundaries.
Open lesson - LESSON 02.03
Testing seams & injected dependencies
Pure functions, fake clocks and retry policies with visible failures and precise interaction tests.
Open lesson - LESSON 02.04
JSONL, schemas & command-line boundaries
Streaming JSON lines, row-level errors, strict schemas and stable machine-readable artifacts.
Open lesson
Python: scientific computing & evidence
- LESSON 03.01
NumPy shapes, axes & numerical stability
Vectorized row normalization and all-pairs distances with explicit axes, zero handling and input independence.
Open lesson - LESSON 03.02
Seeds, splits & train-only transforms
Local random generators, disjoint dataset splits and preprocessing learned only from training data.
Open lesson - LESSON 03.03
Paired comparisons & uncertainty
Sample standard errors and seeded paired bootstrap intervals; separate effect estimates from confidence.
Open lesson - LESSON 03.04
Metrics, thresholds & calibration
Confusion counts, Brier loss and per-bin calibration gaps with explicit denominators and edge policies.
Open lesson
Python: PyTorch & model mechanics
- LESSON 04.01
Tensors, gradients & finite differences
Tensor shapes, scalar losses, autograd graphs and numerical gradient checks without mutating caller state.
Open lesson - LESSON 04.02
Training loops & evaluation mode
Stable binary loss, resetting gradients, gradient descent and mode-preserving inference on tiny CPU models.
Open lesson - LESSON 04.03
Token likelihoods & causal attention
Next-token alignment, log-softmax, target masks and causal scaled dot-product attention on tiny tensors.
Open lesson - LESSON 04.04
Activation probes & controlled interventions
Training-only directions, projection removal and distinguishing predictive probes from causal evidence.
Open lesson
Python: empirical evaluation & research practice
- LESSON 05.01
Bounded async work & cancellation
Concurrent fake requests with bounded in-flight work, ordered results, explicit errors and cancellation propagation.
Open lesson - LESSON 05.02
Structured outputs & adversarial evaluation cases
Strict choice grading, missing and malformed response accounting, prompt/data separation and held-out attack families.
Open lesson - LESSON 05.03
Reproducible artifacts & failure-aware reports
Canonical content hashes and group reports that expose support, coverage and failures instead of hiding missing evidence.
Open lesson - LESSON 05.04
Baselines, ablations & held-out comparisons
Development-only threshold selection, paired IDs, group effects and an original reproducible research practice project.
Open lesson
Python: graphics, geometry & neural rendering
- LESSON 06.01
NumPy for geometry
NumPy the way NeRF and 3DGS research code uses it: broadcasting rules, batched homogeneous transforms with @ and einsum, projecting N points through K[R|t] with an OpenCV pinhole and a behind-the-camera mask, loop-free pairwise distances, views vs copies, and float32 vs float64.
Open lesson - LESSON 06.02
PyTorch tensors and autograd
Autograd the way splatting and NeRF code uses it: the graph, requires_grad and leaves, gradient accumulation, no_grad and detach, in-place pitfalls, a custom torch.autograd.Function with a hand-written backward checked by gradcheck, exp/sigmoid/normalize parameter activations, and the Adam loop with parameter groups.
Open lesson - LESSON 06.03
Cameras and rays from real datasets
Cameras the way NeRF and 3DGS datasets store them: NeRF-synthetic transforms.json (camera_angle_x, OpenGL camera-to-world), COLMAP's w-first quaternion and world-to-camera tvec in OpenCV axes, converting between them, a vectorised get_rays through pixel centres, focal/FOV conversions and scene normalisation.
Open lesson - LESSON 06.04
Image losses and metrics
The numbers every radiance-field paper reports and every 3DGS trainer optimises: MSE and PSNR (per image, in dB, on the right data range), SSIM with an 11 × 11 Gaussian window via grouped conv2d, the (1 − λ)·L1 + λ·D-SSIM loss, sRGB ↔ linear, and why LPIPS exists.
Open lesson - LESSON 06.05
Gaussian splat files with NumPy
Read and write the 3DGS .ply layout with NumPy: binary PLY headers, structured dtypes and np.frombuffer, the x/f_dc/f_rest/opacity/scale/rot attributes, f_rest's channel-major order, activations on load (stable sigmoid, exp, normalised w-first quaternions, SH DC → RGB), round-tripping, and bytes per splat versus compressed formats.
Open lesson - LESSON 06.06
NeRF volume rendering in PyTorch
The renderer around a NeRF's MLP, the way nerf-pytorch writes it: stratified samples, alpha from σδ with ‖d‖, exclusive transmittance with one cumprod, weights and rgb/depth/acc maps, white backgrounds, hierarchical sampling with searchsorted, positional encoding and chunked batching — batched, differentiable and dtype-clean.
Open lesson - LESSON 06.07
Gaussian splatting in PyTorch
The 3DGS forward pass as gsplat's PyTorch reference writes it: activations, Σ = R S Sᵀ Rᵀ by broadcasting, EWA projection Σ′ = J W Σ Wᵀ Jᵀ with the 0.3 px low-pass, conics and radii, a depth sort, and dense front-to-back compositing with an exclusive cumprod — batched, float64-clean, NaN-free and differentiable end to end, fitted with Adam.
Open lesson