Index Ai Academy
Phase 0 · Tools · Working with data

NumPy arrays

Do math on whole columns at once, the foundation of every ML library.

About 30 minutes · Free lesson

Start this lesson

Why it matters

Every machine learning library is built on arrays of numbers. A dataset is a 2D array, an image is a 3D array, a model's weights are arrays, and an embedding (how models represent the meaning of text) is a 1D array of a few thousand decimals. NumPy is where this way of working comes from, and PyTorch, which you'll use for deep learning, copies its interface almost exactly. Learn to think in whole arrays here, and the math in Phase 2 and the models after it become code you can run.

What you'll be able to do

  • Create arrays and read their shape and dtype
  • Do math on whole arrays at once instead of looping
  • Select data with indexes, slices and boolean masks
  • Summarize along an axis, and predict how broadcasting combines shapes

Before this lesson

Next in this phase: The terminal