Machine Learning

How to learn AI from scratch: a 12-week plan for beginners

Learn AI from scratch in order: Python, data tools, maths, statistics, a first model, then an AI app. A 12-week plan with checkpoints and free resources.

To learn AI from scratch, start with Python, then learn the data tools, maths and statistics that models are built on, train and evaluate a first machine learning model, and only then move on to deep learning and generative AI. Build something small at every stage, and move on when you can pass its checkpoint without copying code. To see what that leads to, make an AI program that learns in about 40 lines of Python.

That order works whether you want to train models or build applications on top of them, because both rest on the same foundations. In short:

  1. Python, until you can write and debug a small script on your own.
  2. Data tools: NumPy arrays, pandas tables and charts.
  3. Maths for models: vectors, matrices and derivatives, learned alongside code.
  4. Statistics: describing data, probability and fair comparisons.
  5. A first machine learning model, trained and evaluated against a baseline.
  6. A small generative AI application, tested the way you tested your model.
  7. Deep learning and large language models, once you can train and test a classical model.

Below, you will see what "a program that learns" is in 15 lines of Python, then the order as a 12-week plan with a checkpoint for each stage, the tools you will use and the free courses that teach each part. The pace is a suggestion: take longer where a checkpoint is still hard, and skip ahead where it is already easy.

How to make an AI program that learns

A normal program follows rules a person wrote. An AI program that learns is given examples and adjusts its own numbers until its answers match them. Here is the smallest version, in plain Python with no libraries:

# Examples to learn from: inputs and the right answers.
xs = [1, 2, 3, 4, 5]
ys = [3, 5, 7, 9, 11]  # made with y = 2x + 1; the program is never told this

w, b = 0.0, 0.0  # the program's first guess: y = 0x + 0
for step in range(2000):
    # How wrong is the guess on average, and which way should each number move?
    grad_w = sum(2 * (w * x + b - y) * x for x, y in zip(xs, ys)) / len(xs)
    grad_b = sum(2 * (w * x + b - y) for x, y in zip(xs, ys)) / len(xs)
    w -= 0.02 * grad_w  # nudge each number to make the error smaller
    b -= 0.02 * grad_b

print(f"learned rule: y = {w:.2f}x + {b:.2f}")
print(f"prediction for x = 10: {w * 10 + b:.1f}")

It prints:

learned rule: y = 2.00x + 1.00
prediction for x = 10: 21.0

The program found the rule y = 2x + 1 from five examples, then used it on an input it never saw. Every machine learning model, up to the neural networks behind large language models, works on this idea: measure the error, then change the numbers to make it smaller. The loop above is called gradient descent, and the stages below teach each part of it properly.

How to start learning AI: choose your starting point

Your starting pointFirst taskEvidence you are ready to continue
New to programmingLearn Python functions, lists, dictionaries and reading filesWrite a script that cleans a small CSV
Comfortable with software developmentBuild a data pipeline and a simple prediction baselineExplain how you separated training and evaluation data
Comfortable with statisticsPractise packaging Python code and using GitAnother person can run your experiment from the README
Interested in using AI at workChoose one low-risk task and define a review checklistCompare the output with a human-checked example

If you want the definitions first, what is AI explains how AI, machine learning and deep learning relate. If you are choosing between roles, read the AI engineer vs machine learning engineer comparison. Using an AI assistant is useful practice, but it does not by itself show that you can train or deploy a model.

A 12-week plan to learn AI from scratch

The plan assumes you are new to programming and can study for a few focused sessions each week. Every stage links to the SchoolWhool material that teaches it.

WeeksFocusStudyCheckpoint
1–3PythonGetting started, control flow, data structures and functionsA script that reads a CSV, removes duplicates and prints a summary
4–5Data toolsNumPy, pandas and visualisationA notebook that answers one question about a dataset with a table and a chart
6–7Maths for modelsVectors, matrices and calculus and optimisationCompute a derivative by hand, then check it numerically in NumPy
8–9StatisticsDescribing data, EDA and misleading statistics and probabilityA one-page data report that separates what the data shows from what it cannot show
10–11First modelThe scikit-learn API and gradient descentA baseline and a model compared on held-out data, with errors you can explain
12A small generative AI appWhat is generative AI and the section on generative AI belowA question-answering tool with a written test set, including questions it should refuse

If you already program, compress weeks 1–3 into a review of the data structures cheat sheet and start with data tools. If you already know statistics, spend that time on code quality instead.

The tools you will use

ToolWhat it is forWhen you need it
PythonThe language almost all AI code is written inWeek 1
Jupyter notebooks or Google ColabRunning code step by step and seeing each result; Colab runs onlineWeek 1
NumPyArrays, and the maths of models written as codeWeeks 4–5
pandasLoading, cleaning and summarising tablesWeeks 4–5
MatplotlibCharts, so you look at data before you model itWeeks 4–5
scikit-learnClassical models, data splits, pipelines and metricsWeeks 10–11
A language-model API or an open modelGenerative AI applicationsWeek 12
PyTorchNeural networks and deep learningAfter week 12

Learn them in that order. Every scikit-learn model shares one interface, explained in fit, transform and predict in scikit-learn, so the second model you learn takes far less time than the first.

Learn Python through one small dataset

Choose a public dataset with a clear licence and a question you understand. Load it, inspect missing values, remove duplicates where appropriate, and make a chart. Keep a note of every decision. Try writing the transformation yourself before asking an AI assistant to explain an error.

Your checkpoint is a script someone else can run, plus a short explanation of what the data does and does not represent. Do not start by collecting a long list of frameworks. The Python projects for beginners and pandas projects for beginners articles each give three small, runnable starting points.

Learn the maths alongside the models

Start with vectors and matrices, averages and distributions, and the idea of a derivative. Connect each concept to a task: a vector represents features; probability describes uncertainty; a gradient tells an optimisation algorithm which direction to move.

You do not need a maths degree before your first model, and you should not skip the maths entirely either. Learn each idea when a model needs it, then return to it when a result surprises you. Prerequisites for machine learning lists the short set of maths and statistics ideas that matter most.

Train a baseline and evaluate it honestly

For a first prediction task, compare a simple model against a basic reference such as always predicting the most common class. Decide how to divide the data before training. Keep the final test set separate from choices about models and settings. Google's guide to dividing datasets explains the distinct roles of training, validation and test data.

Watch for leakage: fitting preprocessing on all the data can let information from evaluation examples influence training. Fit learned transformations on the training split. A pipeline keeps those steps together; see scikit-learn's common pitfalls and our guide to data leakage in machine learning.

Your checkpoint is an explanation of the baseline, the evaluation method and several mistakes the model makes. The first-model Python example walks through one complete run.

Try a small generative AI application

Choose a bounded task, such as answering questions about a set of public documents. Write example questions and expected evidence before experimenting. Include a question the documents cannot answer. Check whether the system admits that limitation, cites the right passage, and stays useful when the wording changes.

Record cost, response time and failure cases alongside answer quality. Begin with a simple workflow; add tools or multiple steps only when you can explain the benefit. Do not give an experimental system permission to send messages or change important records.

This stage comes after your first model for a reason. Calling a language model is easy; knowing whether its answers are good enough is the same evaluation problem you practised with your first model. Machine learning vs deep learning explains where generative AI fits among the other terms.

After the first 12 weeks: deep learning and LLMs

Once you can train a classical model and explain its errors, deep learning is the next step. A neural network runs the learning loop from the top of this guide through many layers: the forward pass makes predictions, and backpropagation computes the gradient for every weight. A neural network's forward and backward pass works through one by hand. Learn deep learning in one framework, usually PyTorch, then the transformer, the architecture behind large language models.

SchoolWhool's Deep Learning course teaches neural networks in plain PyTorch, from one hidden layer to the transformer, and the Generative AI course builds on it with language models, retrieval, agents and diffusion. Both syllabuses are published, and their lessons open as they are produced.

How to learn AI from scratch for free

You can learn the foundations of AI without paying. These free options were checked on their official pages on 29 October 2026:

  • SchoolWhool: every open lesson's parts and key terms are free to read with no account, and a free account adds quizzes and saved progress. See the course learning path.
  • Google's Machine Learning Crash Course: videos, interactive visualisations and exercises that run in Colab. Google says you should be a good programmer and comfortable with basic algebra and statistics before you start.
  • fast.ai's Practical Deep Learning for Coders: a free deep learning course built on notebooks. It asks for about a year of coding experience, preferably in Python.
  • Microsoft's Machine Learning for Beginners: an open-source curriculum of classical machine learning in Python and scikit-learn, with quizzes. It deliberately leaves out deep learning.
  • Harvard's CS50's Introduction to Artificial Intelligence with Python: free lectures and projects on search, knowledge, uncertainty, optimisation, learning, neural networks and language. It expects CS50x or about a year of Python.

Most free courses assume you can already program. If you cannot, start with Python; the others become far easier afterwards. Our guide to the best machine learning course for your starting point compares the main options in more detail.

Common mistakes when learning AI from scratch

  • Collecting frameworks instead of finishing tasks. One complete project in scikit-learn teaches more than five half-read framework tutorials.
  • Copying notebooks. Rebuild each example without the finished code, and predict the output before you run it.
  • Skipping evaluation. A model with no baseline and no held-out data has not been tested, however good the score looks.
  • Starting with agents. Multi-step AI systems are hard to evaluate. Build one simple, well-tested application first.
  • Treating the maths as all or nothing. Learn it alongside the models, not entirely before them and not never.

Turn learning into evidence

Publish a README describing your question, data permissions, setup, evaluation and limitations. Include the decisions you made yourself. The machine learning portfolio project guide gives three concrete project briefs and a review checklist.

Then compare your evidence with actual entry-level AI job requirements. Treat gaps as learning tasks, not keywords to add to a résumé. For a longer engineering path, use the machine learning engineer roadmap.

Common questions

How long does it take to learn AI from scratch?

It depends on your starting point and the time you have each week. The 12-week plan above is a suggested pace for the foundations; judge progress by the checkpoints, not the calendar.

Can I learn AI by myself?

Yes. The foundations (Python, data tools, maths, statistics and a first model) are well covered by free material, and the checkpoints in the plan tell you whether you have learned each stage. What is harder alone is noticing your own mistakes, so ask someone to run your project from its README and question your evaluation.

Which programming language should I learn for AI?

Python. NumPy, pandas, scikit-learn, PyTorch and most language-model libraries are Python libraries, and nearly every AI course and tutorial uses it. The Python course starts from zero.

Can I learn AI without coding?

You can learn to use AI tools well without code. To train, evaluate or build AI systems, you need programming, and Python is the usual language.

Should I learn machine learning before generative AI?

For building applications you can trust, yes. Evaluation, data quality and leakage are machine learning ideas, and they decide whether a generative AI application works. You can experiment with language models early, but learn to test them the way you test a model.

Do I need a degree or expensive hardware?

Admission and hiring requirements depend on the course or employer, so read each role's requirements. You can practise Python, data analysis and small classical models on an ordinary laptop or in Colab; larger experiments may need more computing power. Define the experiment before paying for compute.

How do I know I am making progress?

You are making progress when you can reproduce your result, explain a failure, and change one part of the system for a reason. Keep a learning log with the question you answered, the evidence you produced and the next uncertainty to test.

Your next step

Start with the stage that matches your checkpoint, not the one that sounds most advanced. If you are new to code, open the first lesson of Getting started now. Lesson parts and key terms are free to read, and a free account adds the quizzes and saves your progress.

Helping a child start instead? Machine learning for kids lists free tools by age, from sorting games to Scratch and Python.

Related course

Learn Python from zero, the way machine learning code uses it: names and objects, types, control flow, data structures, functions, classes, testing and working with an AI assistant.

Open lessons' parts and key terms are free to read, with no account.

What you will be able to do

  • Predict what a piece of Python code does before running it.
  • Read an error message and find the line that caused it.
  • Write functions, classes and tests for real data tasks.
  • Read and check code an AI assistant wrote for you.