Skip to content
APEX FLOWACADEMY
MENU
Technology / beginner

Machine Learning With Python: From Zero to a Working Model

Build, test and explain a model that predicts home sale prices, in plain words and with no heavy maths

24 lessons6 modulesabout 9 hours10 workbook itemsbeginner
READ LESSON 1 FREE

One payment of $39. Instant online access to the full written course. No subscription. Refund policy.

What you will be able to do

You build, test and explain real models without drowning in maths. By the end you have trained a model on a real table of home sales, tested it honestly, saved it, and written a plain-English report that shows what it can and cannot do.

Who it is for. People who know basic Python and want to build, test and explain their first machine learning models. You do not need a maths background. You do need to be comfortable running a Python script and reading short code.

You finish with. A trained model on a real dataset, with a plain-English report. You finish with a working model that predicts the sale price of a home in Ames, Iowa from nine facts about it. It is built with a leak-proof pipeline, compared against a baseline, scored with cross-validation, tuned without peeking, and tested once on rows it never saw. You save it to a file and write a short report for a reader who does not code. The report says how far off the model is, what it leans on, and where it is weak.

Certificate. Finish every lesson, resolve every quiz question with at least 50% right on the first try, and tick the capstone checklist — Apex Flow Academy issues a verifiable Certificate of Completion with a unique ID and a public verification page. It is a certificate of completion, not a degree, licence, accreditation or exam result.

The path, module by module24 lessons
01 · What a model is, and your first working one4 lessons

Learn what a machine learning model is in plain words, set up Python, run your first model, and meet the home-sales table you will use for the whole course.

  1. 1.1A model is a pattern learned from examplesFREE
  2. 1.2Set up Python and your libraries
  3. 1.3Your first model: fit, then predict
  4. 1.4Meet your project table
02 · Prepare the data so a model can learn4 lessons

Hold back an honest test set, fill blanks, turn words into numbers and put numbers on one scale, all without letting the test rows leak in.

  1. 2.1Hold back an exam: the train-test split
  2. 2.2Fill the blanks using only the training rows
  3. 2.3Turn words into numbers with one-hot columns
  4. 2.4Put numbers on the same scale
03 · Predict a category: classification4 lessons

Learn to ask a yes-or-no question of your data, set a baseline, and try three classic classifiers: logistic regression, a decision tree and a random forest.

  1. 3.1Beat the baseline first
  2. 3.2Logistic regression: a weighted sum turned into a probability
  3. 3.3Decision trees: rules a person can read
  4. 3.4Random forests: many trees vote
04 · Predict a number: regression4 lessons

Fit a line and a forest to predict sale prices, measure the size of the misses in plain units, and learn to spot underfitting and overfitting with a validation set.

  1. 4.1Linear regression: the best straight line
  2. 4.2Measure the size of the misses
  3. 4.3Forests for numbers, and what they cannot do
  4. 4.4Underfitting, overfitting and the validation set
05 · Judge your model honestly4 lessons

Bundle your preparation into a pipeline, score with cross-validation, read precision and recall, and tune settings without ever peeking at the test rows.

  1. 5.1Pipelines: prepare and predict in one object
  2. 5.2Cross-validation: five exams instead of one
  3. 5.3Precision and recall: the two kinds of mistake
  4. 5.4Tune settings without peeking
06 · Explain it, save it, and write the report4 lessons

Find out what your model leans on, save it and use it on a new row, learn where it is weak, and finish with a plain-English report that someone who does not code can trust.

  1. 6.1Which columns does the model lean on?
  2. 6.2Save your model and use it on a new row
  3. 6.3Know where the model is weak
  4. 6.4Capstone: write the plain-English report
Free preview · lesson 1.1No sign-up
Free lesson · 1.1

A model is a pattern learned from examples

About 6 minStep 1 of 7 · You will be able toNo sign-up
Step 1 of 71 min read

You will be able to

  • Say what a model is in your own words.
  • Point to the features and the label in any table.
  • Tell training (learning) apart from predicting (using).
Step 2 of 71 min read

Why this matters

Every lesson uses the same few words: feature, label, model, training and predicting. If those words are fuzzy, the code will feel like magic. This course ends with a model that predicts home sale prices from a real table, plus a plain-English report about it. Each module ends with a small project that adds one piece to that final work. Each lesson has a short task and a three-question quiz, so read, do the task, then take the quiz. Here you learn the words with a pencil and a tiny table, before you type any code.

Step 3 of 71 min read

Learn it

Normal software follows rules that a person wrote. A price calculator might say, 'add 50 dollars for each bedroom.' Someone had to guess that rule.

Machine learning flips this around. You give the computer many past examples, each with the right answer. The computer looks for a pattern in them and builds its own rule. That rule is called a model.

These words are used all course. Each is defined once, here.

  • Row: one example. In a table of home sales, one row is one home.
  • Feature: one fact you know before you predict. The size of a home is a feature.
  • Label (also called the target): the answer you want to predict. The sale price is a label.
  • Training (also called fitting): the learning step. The model studies rows where the label is already known.
  • Predicting: the using step. The model receives the features of a new row and returns a guess for the label.

There are two common kinds of question.

  • Predict a number, such as a price or a delivery time. This is called regression.
  • Predict a category, such as yes or no. This is called classification.

Use these steps to frame any problem.

  1. Write the question as one sentence: 'Given these facts, predict this answer.'
  2. List the facts you will know on the day you need the prediction. These are your features.
  3. Check that you have past rows where the answer is known. That column is your label.
  4. Decide if the answer is a number or a category.

One warning to keep in mind. A model only knows what its examples show. It finds patterns. It does not know why they exist, and it cannot see the future.

Step 4 of 71 min read

See it in action

Example (illustrative numbers). A small table of past home sales:

Text
size (sq ft)   price ($ thousands)
900            120
1100           150
1300           170
1500           190
1700           230
2100           290

The question is: 'Given the size of a home, predict its price.' Size is the feature. Price is the label. The answer is a number, so this is regression.

Now predict the price of a new home of 1,450 sq ft. We use a simple pattern-finding method.

  1. Work out how far each past home is from 1,450 sq ft. The 1,500 home is 50 away. The 1,300 home is 150 away. The 1,700 home is 250 away. The rest are farther.
  2. Keep the two closest homes: 1,500 (price 190) and 1,300 (price 170).
  3. Average their prices: (190 + 170) / 2 = 180.
  4. The prediction is 180 thousand dollars.

That is a real model. Its training step is storing the table. Its predicting step is the four moves above. A computer does the same job on thousands of rows and many features at once.

Step 5 of 71 min read

Common mistakes

  • Putting the answer inside the features. It happens because the price column sits in the same table as the size column. Fix: name the label first, then build the feature list without it.
  • Expecting the model to explain why. A model finds patterns. It does not know reasons. Fix: treat every prediction as an estimate, and later lessons show how to check the estimates.
  • Using a fact you will not have in real life. For example, a final invoice total cannot help predict a complaint that happens before the invoice exists. Fix: for each feature, ask, 'Will I have this on the day I need the prediction?'
Step 6 of 71 min read

You are done when

You can take any table, write the question as 'Given ___, predict ___', circle the features, underline the label, and say whether the question is regression or classification.

Step 7 of 7

You finished the free lesson

That is one lesson from the course. The full course gives you every remaining lesson, a quick check and a hands-on task in each one, and the workbook of templates and checklists.

Full course$39

What you need
  • A computer running Windows, macOS or Linux. Any recent laptop is enough. There is no need for a graphics card.
  • Python 3.12 or newer, free from python.org. Python 3.11 also works, but it installs older library versions, so some numbers may differ slightly.
  • Free libraries installed with pip: scikit-learn, pandas and their dependencies. No paid tool or subscription is needed for any lesson.
  • A text editor. VS Code is a free choice. Notepad also works.
  • An internet connection for the one-time install and for a one-time download of the project table (about half a megabyte).
  • Roughly nine hours in total for the reading, the exercises and the capstone. Spread it over whatever schedule suits you.
Before you start
  • Basic Python: variables, lists, dictionaries, functions, and running a .py file from a terminal.
  • Being able to install a Python package with pip and open a terminal or command prompt.
  • Comfort reading a table of rows and columns, like a spreadsheet.
  • School-level maths only: averages and percentages. No calculus or linear algebra is needed.
The capstone

A trained model on a real dataset, with a plain-English report

You finish with a working model that predicts the sale price of a home in Ames, Iowa from nine facts about it. It is built with a leak-proof pipeline, compared against a baseline, scored with cross-validation, tuned without peeking, and tested once on rows it never saw. You save it to a file and write a short report for a reader who does not code. The report says how far off the model is, what it leans on, and where it is weak.

  • data_card.md: the question, the label, the nine features, the blanks and the limits of the table.
  • prep.py and model.py: the preparation code and the pipeline, with every learned step fitted on training rows only.
  • results.md: the baseline, line and forest comparison, the cross-validation averages and spreads, the chosen settings, and the single final test score.
  • ames_model.joblib and model_notes.txt: the saved pipeline and a note of the library version and training details.
  • report.md: a plain-English report with seven parts: summary, question and data, what we did, results, what the model leans on, limits, and how to use it.
  • requirements.txt: your library versions so the work can be rebuilt.
Key terms taught30
Model
A pattern a computer learns from past examples, which it then uses to guess an answer for a new row.
Feature
One fact you know before you predict, such as the size of a home.
Label (target)
The answer you want to predict, such as the sale price.
Row
One example in a table, such as one home.
Training (fitting)
The learning step, where the model studies rows whose answers are already known.
Predicting
The using step, where a trained model gives a guess for a new row.
Regression
A prediction question whose answer is a number, such as a price.
Classification
A prediction question whose answer is a category, such as yes or no.
Baseline
The simplest sensible guess, such as always saying the most common answer. A real model must beat it.
Accuracy
The share of guesses that are right, for a yes-or-no or category question.
Training set
The rows the model is allowed to study.
Test set
Rows held back and hidden, used once at the end to give an honest score.

Browse the full Academy encyclopedia

How this course was checked

27 checks were run and recorded while writing this course (code, formulas, commands and facts), and it lists 9 official sources it was checked against. Prices, features and policies of outside tools can change, so check each tool's own website.

Created by Apex Flow Academy with AI assistance. For education only; not legal, tax, financial or medical advice. Results depend on your effort and circumstances.