TodayTools

Machine learning flashcards

Teach computers to learn patterns from data.

Donate
Beginner friendly, starts from zero
Section
How to study
0
Machine learningStart from zero · 1 of 12

What is machine learning, in one plain sentence?

Teaching a computer by showing it many examples, instead of writing every rule by hand, so it can make good guesses about new cases.

Show, do not tell.

All topics

Machine learning at a glance

Machine learning teaches a computer to make good guesses by showing it many examples instead of writing every rule.

It is like a child learning fruit names: after seeing many named apples and bananas, he can name a new fruit with no rule book.

Words you will meet

Data
Recorded facts, usually a table of rows and columns
Feature
A detail you already know about an example, like a house's area
Label
The answer you want the computer to guess, like the price
Model
A formula with numbers the computer tunes from examples
Training
Letting the model guess, check its errors and adjust, many times
Prediction
The model's guess for a new example
Test set
Examples hidden during training, used to check the model fairly
Accuracy
The share of test answers the model got right

The steps

  1. 1. Start from zero (12 cards): What learning from examples means, the key words, and a model in three lines.
  2. 2. Core basics (16 cards): What ML is, features and labels, splits, your first model and data quality.
  3. 3. Next steps (16 cards): Loss, metrics, cross-validation, tuning, trees and pipelines.
  4. 4. Go deeper (16 cards): Leakage, imbalance, calibration, drift, fairness and shipping models.
All 12 cards in Start from zero
What is machine learning, in one plain sentence?
Teaching a computer by showing it many examples, instead of writing every rule by hand, so it can make good guesses about new cases.
What problem does it solve that normal programs could not?
Some jobs have too many rules to write, like spotting spam or reading handwriting. People wrote rule after rule, and the rules kept breaking as the world changed.
Where do you already use machine learning every day?
Spam filters, phone face unlock, video suggestions, map arrival times and the next-word hints on your phone keyboard all come from machine learning.
What is an everyday picture of how a machine learns?
A child sees many apples and bananas, each named by a parent. Soon he names a fruit he has never seen. Nobody gave him a rule list; he learned the pattern.
What are data, rows and columns?
Data is recorded facts, usually kept in a table. Each row is one example, such as one house, and each column is one detail about it, such as its area or city.
What are features and a label?
Features are the details you already know, like a house's area and city. The label is the answer you want the computer to guess, like the house price.
What are a model, its parameters and a prediction?
A model is a formula the computer builds from examples. Its parameters are the numbers inside it that get tuned. A prediction is the model's guess for a new example.
What happens during training, and what is loss?
Training means the model guesses on examples, measures how wrong it was (the loss, a wrongness score), and adjusts its numbers to be a little less wrong. This repeats many times.
What are a test set and accuracy?
You hide some examples during training, like keeping back exam questions. The test set checks the model on them, and accuracy is the share of answers it got right.
Your first tiny win: what does this little model print?
55.0, meaning 55 lakh rupees. The parameters are 0.04 and 15, the feature is the area, and the printed prediction is the price. Training is just finding good numbers like these.
What do you need before starting this topic?
For the ideas, nothing at all. For the code cards, basic Python helps, and you can run it in any free online Python notebook in your browser.
What will you be able to do after this topic?
Turn a real question into a machine learning task, prepare the data, train and test a first model in Python, and tell whether its score is truly good.
Machine learning cheatsheet

scikit-learn core

  • model.fit(X, y) Learn from training data
  • model.predict(X) Labels or values
  • model.predict_proba(X)[:, 1] Positive-class probability
  • train_test_split(..., stratify=y) Keep class mix in both sets
  • cross_val_score(pipe, X, y, cv=5) Five-fold scores
  • make_pipeline(prep, model) Preprocessing and model as one object
  • ColumnTransformer([...]) Per-column preprocessing

Metrics

  • precision TP / (TP + FP): are alerts right?
  • recall TP / (TP + FN): did we catch them?
  • F1 Harmonic mean of precision and recall
  • PR AUC Rare-class ranking quality
  • ROC AUC Overall ranking, flattering when imbalanced
  • RMSE / MAE Regression error; RMSE punishes big misses
  • Brier score Probability calibration

Pick a model

  • Tabular, any size HistGradientBoosting, LightGBM, XGBoost
  • Need explanations Logistic regression or a shallow tree
  • Small, clean baseline Logistic or linear regression
  • Images, text, audio Fine-tune a pretrained neural net
  • Groups, no labels k-means or HDBSCAN
  • Rare anomalies IsolationForest

Split strategies

  • StratifiedKFold Classification, keep class ratios
  • TimeSeriesSplit Past to train, future to validate
  • GroupKFold Same patient or user stays in one fold
  • Hold-out test Touched once, at the end

Symptom and fix

  • Train high, test low Regularise, simplify, more data
  • Both low Better features, more flexible model
  • Too-good score Hunt for leakage
  • Rare class ignored class_weight, PR AUC, tune threshold
  • Probabilities off CalibratedClassifierCV
  • Live accuracy falls Check drift, retrain on recent data
Donate