Skip to main content

10 docs tagged with "NumPy"

Arrays, broadcasting, and vectorised numerical work.

View all tags

Arrays and Attributes

Creating ndarrays, the six shape attributes, dtypes, and why an array is not a list.

Batch, Stochastic and Mini-Batch

One decision left — how many rows the model looks at before each step. "Stochastic is faster" turns out to need a unit attached, because batch beat single-row descent on passes, on seconds and on final cost, single-row descent could not converge at all at a constant step size, and yet mini-batch 32 reached a loose target after reading 4% of one pass where batch read 50 full passes and still missed.

Gradient Descent

Walking downhill in fog, made precise — why two different plots both get called the gradient descent curve, why the algorithm slows near the bottom with nothing in the loop programming a brake, why flipping one minus sign sends the cost to 6.33e+07, and why the neat round bowl in every textbook is the one case that never happens in practice.

Loading and Preparing Data

Why read_csv is not a neutral loader, the missingness it silently fails to catch, a pre-flight audit that catches it, and whether to convert to NumPy at all.

Operations and Broadcasting

Element-wise arithmetic, the broadcasting rules, universal functions, matrix multiplication, sorting and stacking.

The Learning Rate

The learning rate is your stride length, and there is an exact cutoff between working and exploding that you can compute instead of guess — verified to 3.3e-16. Also why an alpha 0.4% too large looks merely slow for a thousand iterations, why overshooting is the fastest regime rather than a fault, and why the textbook optimal alpha measured 2.20x slower than a slightly smaller one.

The Matrix Formulation

Solving for every coefficient in one algebraic step — the design matrix, the column of ones, the normal equation verified against scikit-learn, and the three situations where the inverse does not exist.

The Toolkit and the Pipeline

The five Python libraries that do the work, how they stack, scikit-learn's fit/predict/transform contract, and the seven-step pipeline every project follows.