Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Python & Math: All You Need for AI
New
2 students

Python & Math: All You Need for AI

Python, NumPy, pandas, linear algebra, calculus & probability, then build ML, neural nets & a tiny LM from scratch
Created byThanh Vũ
Last updated 11/2026
English
English [Auto],

What you'll learn

  • Write Python programs from scratch with functions, comprehensions, lambda, map, filter and reduce
  • Replace slow Python loops with NumPy and predict every array shape before running the code
  • Clean, explore, group and merge real data with pandas, and choose the right Matplotlib chart
  • Compute vectors, dot products, cosine similarity and matrix products by hand and in NumPy
  • Calculate derivatives and gradients, and check every gradient numerically
  • Build an autograd engine with the chain rule and match PyTorch's gradients
  • Implement softmax, cross-entropy and perplexity without numerical overflow
  • Build k-NN, logistic regression, k-means and a decision tree by hand, then match scikit-learn
  • Train neural networks with SGD and Adam, and diagnose bad runs from the loss curve
  • Build a small language model from scratch and implement one attention head

Course content

19 sections • 149 lectures • 30h 11m total length
  • 0.1 What you'll build in this course9:52
  • Quiz 0.1: what you'll build in this course
  • 0.2 How every lesson works8:55
  • Quiz 0.2: how every lesson works
  • 0.3 Set up Colab and VS Code10:31
  • Quiz 0.3: set up Colab and VS Code

Requirements

  • No programming experience needed. Part 1 starts from your first line of Python.
  • High-school arithmetic. Everything else is taught step by step.
  • A computer with a web browser. Notebooks run free in Google Colab.

Description

This course contains the use of artificial intelligence.

Most AI tutorials start in the middle. They hand you a fit() call, a DataFrame and a formula with Σ, and expect you to follow along. If you never learned the foundations, you end up copying code you can't fix.

This course goes from your first line of Python to a tiny language model with attention that you write yourself, one step at a time.

Every lesson follows the same path: 1. Theory on slow, clear slides. One idea per slide, with animations for every number and every array shape. 2. A hand calculation with small numbers, so you see the idea before any code. 3. Your own code, written line by line. 4. The library version (NumPy, pandas, scikit-learn or PyTorch), checked against your code so you know they agree. 5. Live coding in VS Code, typed in real time.

Part 1: Foundations (9 chapters, 78 lessons) - Python from zero: variables, conditions, lists, dictionaries, loops, files and errors. - Every way to write a function: comprehensions, lambda, map, filter, reduce, generators, classes and the special methods that AI libraries are built on. - NumPy: arrays, shapes, axis and broadcasting. Replace slow loops and predict every shape before you run the code. - Matplotlib and pandas: pick the right chart, then clean, group and merge real data (the Palmer penguins dataset). - Vectors and matrices: norms, dot product, cosine similarity, matrix multiplication and a neural-network layer, by hand and in code. - Capstone 1: a penguin data report and a semantic search engine written from scratch, checked against scikit-learn.

Part 2: ML from Scratch (10 chapters, 71 lessons) - Derivatives and gradient descent: fit a line three ways and check every gradient numerically. - Your own autograd engine with the chain rule, matched against PyTorch. - Probability, statistics and information: softmax without overflow, sampling, temperature, entropy, cross-entropy and perplexity. - Classic ML on real data: k-NN, logistic regression, k-means and decision trees, by hand and with scikit-learn, plus metrics, cross-validation and pipelines without data leakage. - Neural networks: the training loop, Adam from scratch, and how to fix a bad training run from its loss curve. - SVD and PCA: compress an image, plot data in 2D and see why LoRA stays small. - Capstone 2: a tiny language model in NumPy that invents new names and beats a baseline. Then you decode softmax(QKᵀ/√d)V and write one attention head yourself.

Already comfortable with Python and NumPy? Part 2 opens with a 10-question entry check, so you can start right there.

All notebooks run free in Google Colab. You don't need a GPU or an API key.

Who this course is for:

  • Beginners who want to move into AI with real foundations, not copy-paste code
  • Developers and analysts who use ML libraries and want to know what happens inside them
  • Students preparing for deep learning and LLM courses who need solid math foundations