Course 1 of 9
Python for AI
After this course you can read and run the code of every lesson in the series, and load a pretrained model.
15 lessons, 5 labs and a project. About 1 h 25 min of video.
Start with lesson 1- Notebooks and environmentsA notebook runs your cells on one Python, which remembers only what you ran and imports only what was installed into it.9 min
- Your first lines of PythonA variable keeps a value under a name; text and numbers act differently, and a function such as
intturns text into a number.4 min - Lists, loops and ifA list keeps values in order; a for loop runs the indented lines under it once for each value, and an if runs its own only when its test is True.5 min
- Lab 1Score a chatbot's answersYou will take a chatbot's answers as text, turn them into numbers, and count how many are right with a loop and an if.25 min
- Dicts and functionsA dict finds a value by its key; a function does one job when it is called, and a comprehension does it for every item of a list.6 min
- Classes, just enoughA class is a plan for objects: each object keeps its own values, and its methods reach them through
self.8 min - Lab 2A tiny tokenizerYou will turn a sentence into numbers with a dict and a function, handle a word the vocabulary does not hold, put it all in a class, and turn the numbers back into words.30 min
- NumPy arraysA NumPy array is a grid of numbers with a shape, rows first, and you pick from it with one position or one slice for each side.7 min
- Vectorization and broadcastingOne line on the whole array replaces a loop, and NumPy repeats a smaller array to fit when the shapes line up on the right.8 min
- Lab 3A thousand digits, no loopYou will cut pictures out of a stack of 1,797 handwritten digits, read their shapes, and change every number of every picture in one line, with no loop.30 min
- Tables with pandaspandas reads a CSV into a table with named columns; a comparison on a column marks every row True or False, the table keeps the True rows, and
groupbygives one number for each group.6 min - Plotting to see dataEach plot answers one kind of question: a histogram shows how values spread, a scatter plot how two values move together, and a line plot how one value changes over steps.4 min
- The scikit-learn patternEvery scikit-learn model is an object that learns from a table with
fit, then answers withpredict; a tool that changes the table learns withfittoo, then answers withtransform.6 min - Lab 4From a table to a first predictionYou will load a table of 398 real cars, keep the rows you want, sum up each group, draw the plot that answers a question, and teach two models to tell where a car was made.40 min
- PyTorch tensors and their shapesA tensor is PyTorch's array, and a layer for pictures reads it as four sides, (batch, channels, height, width), on the CPU or on the GPU.5 min
- Calling an APIA program asks an API for data with a request; the answer comes back with a status code and JSON, which Python reads as dicts and lists, and a key that proves who is asking stays outside the code.5 min
- From a notebook to a scriptA script is a file of Python that the terminal runs from the first line to the last; it finds the file in the terminal's folder, and it shows a value only when you print it.5 min
- Git and GitHubGit keeps every snapshot you commit of a project's folder, and GitHub keeps a copy of them where others can read it, so a file with your key must never be committed.5 min
- Lab 5On your own computerYou will set Python up on your own computer, run a script that asks the Hugging Face Hub about a model, turn a stack of pictures into a batch a layer can read, and keep it all in Git with the key's file kept out.45 min
- EndingWhat can you build now?That's the whole course. Here's what you can do now, the project where you run a real model yourself, and the labs to start with.1 min
- ProjectRun a pretrained model, and check its claimYou build a project that downloads a sentiment model and its test sentences from the Hugging Face Hub, checks the accuracy the model's page claims, and tries the model on reviews you wrote yourself.3 h
