Courses / Beginner, no coding needed

Python for AI

Write real Python in the page, from your first line to a network that learns, with no installation. 15 lessons in 4 modules, about 2 hours in all.

0 of 15 lessons done

Next up: Your first program

Python basics

Values, variables, lists, loops and functions: everything the rest of the course is built from.

5 lessons, 37 minutes

  1. 1Your first programWrite a line of Python, run it, and see what comes back. Everything in AI code starts with instructions this plain.6 min
  2. 2Variables and typesGive a value a name so you can use it again. Numbers, text and true-or-false are the three kinds you will meet most.7 min
  3. 3Lists and loopsKeep many values in one list, and repeat a step for each of them. This pair does most of the work in any data program.8 min
  4. 4FunctionsWrap steps you use often under a name, give them inputs, and get an output back. Every model is one function made of many smaller ones.8 min
  5. 5Dictionaries and textLook values up by name instead of position, and take text apart letter by letter. Together they are how a program reads language.8 min
  6. Module 1 quiz: Python basics10 questions with diagrams to drag, slide and click. Pass with 12 to open what comes next.20 marks

Numbers in code

Vectors, matrices, randomness and error, written by hand so nothing is hidden.

4 lessons, 33 minutes

  1. 1Vectors as listsA vector is a list of numbers, so everything from the vectors module can be written in a few lines of Python. Write the dot product yourself.8 min
  2. 2Matrices as lists of listsA matrix is a list of rows. Write matrix-times-vector yourself and you have written the core of a neural network layer.9 min
  3. 3Randomness and probabilityUse Python's random numbers to roll dice, estimate probabilities and draw from a distribution, which is how a model picks its next word.8 min
  4. 4Measuring errorA loss is one number that says how wrong a model is. Write mean squared error and cross-entropy in Python and see how each one scores guesses.8 min
  5. Module 2 quiz: Numbers in code10 questions with diagrams to drag, slide and click. Pass with 12 to open what comes next.20 marks

Learning in code

Gradient descent, a fitted line, a neuron and a small network, each in a page of code.

4 lessons, 37 minutes

  1. 1Gradient descent in codeFind the bottom of a curve by repeatedly stepping downhill. The whole algorithm that trains every model is a five-line loop.8 min
  2. 2Fitting a lineGive a model two parameters and some data, and let gradient descent find the line through the points. Your first complete training loop.9 min
  3. 3A neuron in codeA neuron weighs its inputs, adds a bias and squashes the result. Train one to separate two groups of points.9 min
  4. 4A small networkPut a hidden layer between the inputs and the output, write backpropagation by hand, and watch the network learn the XOR pattern a single neuron cannot.11 min
  5. Module 3 quiz: Learning in code10 questions with diagrams to drag, slide and click. Pass with 12 to open what comes next.20 marks
  6. Checkpoint 1: modules 1 to 325 questions with diagrams to drag, slide and click. Pass with 30 to open what comes next.50 marks

Language in code

Count letters, build a bigram model and generate new words.

2 lessons, 18 minutes

  1. 1A bigram model in PythonCount which letter follows which in a list of names, turn the counts into probabilities, and you have a working language model in twenty lines.9 min
  2. 2Generate textDraw one character at a time from your bigram model and new names appear. Then add temperature and see how one number changes its personality.9 min
  3. Module 4 quiz: Language in code10 questions with diagrams to drag, slide and click. Pass with 12 to open what comes next.20 marks
  4. Case study50 questions with diagrams to drag, slide and click. Pass with 30 to open what comes next.50 marks
  5. Final paper50 questions with diagrams to drag, slide and click. Pass with 60 to open what comes next.100 marks