O'Reilly logo
live online training icon Live Online training

Machine Learning Foundations: Intro to Linear Algebra

An Interactive Primer on the Theory and Practice of Tensor Manipulation in Python

Jon Krohn

The Machine Learning Foundations series of online trainings provides a comprehensive overview of all of the subjects -- mathematics, statistics, and computer science -- that underlie contemporary machine learning techniques, including deep learning and other artificial intelligence approaches.

All of the classes in the series bring theory to life through the combination of vivid full-color illustrations, straightforward Python examples within hands-on Jupyter notebook demos, and comprehension exercises with fully-worked solutions.

The focus is on providing you with a practical, functional understanding of the content covered. Context will be given for each topic, highlighting its relevance to machine learning. You will be better-positioned to understand cutting-edge machine learning papers and you will be provided with resources for digging even deeper into topics that pique your curiosity.

The eight classes in the series are organized into four couplets:

Linear Algebra



Computer Science

The content in the second class of each couplet follows directly from the content of the first, however you’re most welcome to pick and choose between any of the individual classes based on your particular interests or your existing familiarity with the material. (Note that at any given time, only a subset of these courses will be scheduled and open for registration. To be pushed notifications of upcoming classes in the series, sign up for the instructor's email newsletter at jonkrohn.com.)

This class, Intro to Linear Algebra, is the first in the Machine Learning Foundations series. It is essential because linear algebra lies at the heart of most machine learning approaches and is especially predominant in deep learning, the branch of ML at the forefront of today’s artificial intelligence advances. Through the measured exposition of theory paired with interactive examples, you’ll develop an understanding of how linear algebra is used to solve for unknown values in high-dimensional spaces, thereby enabling machines to recognize patterns and make predictions. The content covered in this class is itself foundational for all the other classes in the Machine Learning Foundations series and it is especially relevant to Linear Algebra II.

What you'll learn-and how you can apply it

  • Understand the fundamentals of linear algebra, a ubiquitous approach for solving for unknowns within high-dimensional spaces.
  • Develop a geometric intuition of what’s going on beneath the hood of machine learning algorithms, including those used for deep learning.
  • Be able to more intimately grasp the details of machine learning papers as well as all of the other subjects that underlie ML, including calculus, statistics, and optimization algorithms.

This training course is for you because...

  • You use high-level software libraries (e.g., scikit-learn, Keras, TensorFlow) to train or deploy machine learning algorithms, and would now like to understand the fundamentals underlying the abstractions, enabling you to expand your capabilities
  • You’re a software developer who would like to develop a firm foundation for the deployment of machine learning algorithms into production systems
  • You’re a data scientist who would like to reinforce your understanding of the subjects at the core of your professional discipline
  • You’re a data analyst or A.I. enthusiast who would like to become a data scientist or data/ML engineer, and so you’re keen to deeply understand the field you’re entering from the ground up (very wise of you!)


  • All code demos will be in Python so experience with it or another object-oriented programming language would be helpful for following along with the hands-on examples.

Materials, downloads, or Supplemental Content needed in advance

  • During class, we’ll work on Jupyter notebooks interactively in the cloud via Google Colab. This requires zero setup and instructions will be provided in class.


  • Familiarity with secondary school-level mathematics (e.g., the basic algebra covered in Chapter 1 of Hadrien Jean’s book) will make the class easier to follow along with.

About your instructor

  • Jon Krohn is Chief Data Scientist at the machine learning company untapt. He authored the 2019 book Deep Learning Illustrated, an instant #1 bestseller that was translated into six languages. Jon’s also the presenter of dozens of hours of popular video tutorials such as Deep Learning with TensorFlow, Keras, and PyTorch. And he’s renowned for his compelling lectures, which he offers in-person at Columbia University, New York University, and the NYC Data Science Academy. Jon holds a PhD in neuroscience from Oxford and has been publishing on machine learning in leading academic journals since 2010.


The timeframes are only estimates and may vary according to how the class is progressing

Segment 1: Data Structures for Algebra (70 min)

  • What Linear Algebra Is
  • A Brief History of Algebra
  • Arrays in NumPy
  • Scalars
  • Vectors and Vector Spaces
  • Special Vectors: Unit, Basis, Zero, Row, Column, Orthogonal
  • Matrices
  • Tensors
  • Tensors in TensorFlow and PyTorch
  • Pandas DataFrames
  • Q&A and Break

Segment 2: Tensor Operations (70 min)

  • Basic Arithmetical Properties
  • Transposition
  • Reduction
  • Summing Without Reduction
  • The Dot Product
  • Linear Equations and Solutions
  • Q&A and Break

Segment 3: Matrix Properties (70 min)

  • Multiplying Matrices and Vectors
  • Identity and Inverse Matrices
  • Linear Dependence and Span
  • Norms
  • The Relationship of Norms to Objective Functions
  • Special Matrices: Diagonal, Symmetric, and Orthogonal
  • Final Exercises and Q&A