Python for AI

Eight free lessons: from your first functions to a small model on your own computer.

About Python for AI
01 1 free lab
Python for AI: your environment and first function

Set up an isolated CPU environment, check your Python, NumPy and PyTorch versions, and write a diagnostic function.

18 min reading · intro
02 practice 1 lab
Records, functions and clear errors

Work with dictionaries and lists, validate a dataset record, and count incident categories.

16 min reading · easy
03 1 lab
JSONL: reading data one line at a time

Learn the JSONL format and read the course corpus with a line length limit and precise error messages.

18 min reading · easy
04 1 lab
NumPy: turning text into numbers

Build simple numeric text features, understand shape and dtype, and calculate mean squared error.

18 min reading · easy
05 1 lab
An honest experiment: splits and baselines

Split related records by group, prevent data leakage, and compare your future model with a majority baseline.

18 min reading · medium
06 1 lab
PyTorch: tensors, autograd and optimizers

Train a linear model y = wx + b on the CPU and trace how a loss changes its parameters.

18 min reading · medium
07 1 lab
A small incident classifier

Build an Embedding → masked mean → Linear model, then check shapes, PAD, UNK and a short CPU training run.

20 min reading · medium
08 1 lab
Evaluation, checkpoints and the final CLI

Compare the model with a baseline, save state_dict safely, and run validate → train → evaluate → predict end to end.

20 min reading · medium