
06 · Contraction with einsum
Part IV, Block 3 of Tensors for Machine Learning. One rule that looks compact in code and has a very simple meaning:
If an index disappears after
->, NumPy sums over it. If the index remains, it survives in the output.
Recommendation and search systems rank items by the dot product between a user vector and every item vector — one user against millions of items, many times per second. That contraction is the ranking signal. Sum over the wrong axis and every user gets wrong results.
Study here, then run the real thing: notebook 06 on Colab · the handbook · Kahoot 2
Built from the workshop’s own material by Ravi Kalia and Sebastian Laverde Chunza, CC BY 4.0.
Choose how to study
Flash Cards
Flip between question and answer, in both languages, at your own pace.
Rapid Repetition
Short sessions that resurface exactly what you forget, until it sticks.
Practice Test
Exam-style questions with a score at the end. Find your weak spots.
Quiz Game
Beat the clock: answer before time runs out and raise your high score.
Explore the topics
Read it all?
Rapid repetition replays exactly what you forget — the fastest way to lock it in before the exam.