Python for AI
Eight free lessons: from your first functions to a small model on your own computer.
About Python for AISet up an isolated CPU environment, check your Python, NumPy and PyTorch versions, and write a diagnostic function.
Work with dictionaries and lists, validate a dataset record, and count incident categories.
Learn the JSONL format and read the course corpus with a line length limit and precise error messages.
Build simple numeric text features, understand shape and dtype, and calculate mean squared error.
Split related records by group, prevent data leakage, and compare your future model with a majority baseline.
Train a linear model y = wx + b on the CPU and trace how a loss changes its parameters.
Build an Embedding → masked mean → Linear model, then check shapes, PAD, UNK and a short CPU training run.
Compare the model with a baseline, save state_dict safely, and run validate → train → evaluate → predict end to end.