B3PythonIntermediateAbout 110 min to complete
Broadcasting
The ability to predict — rather than guess at — how arrays of different shapes combine.
Notebook
About 110 minutes to complete
Enrol to read the notebook and download it to run.
What this module covers
The ability to predict — rather than guess at — how arrays of different shapes combine.
By the end of it
- State the two broadcasting rules and apply them mechanically to any pair of shapes
- Predict the output shape of any broadcast operation before running it
- Diagnose a broadcasting ValueError from its message alone
- Use np.newaxis, reshape, and keepdims to align shapes deliberately
- Explain why broadcasting uses no extra memory
- Normalise rows and columns of a matrix in one line each
- Standardise a dataset (z-scores) — the universal machine-learning preprocessing step
- Compute outer products and pairwise distance matrices without loops