Glossary¶
The key terms of this course in plain English. Each one links to the page that teaches it.
amount_ratio¶
The one new feature we create in Section 06: transaction_amount divided by avg_transaction_amount, so it shows how many times bigger a purchase is than the customer's usual spend. A customer who usually spends $100 and makes a $2,500 purchase gets a ratio of 25.0, which is a warning sign of fraud.
Learn it in 06 Feature Engineering.
Baseline model¶
The first simple model we build, and the one every later model must beat: Logistic Regression on the 8 original features with class_weight='balanced'. It catches 46 of 60 test frauds and earns a Net Benefit of $39,625.
Learn it in 04 Model Training and Inference.
Class imbalance¶
When one class is much rarer than the other. In our data only 298 of 10,000 transactions (2.98%) are fraud, and with no extra weight on fraud a model can learn to call every transaction legitimate, which is why the course uses class_weight.
Learn it in 05 EDA and Preprocessing.
class_weight¶
A Logistic Regression setting that says how much a mistake on each class counts during training. The baseline uses 'balanced' (about 32:1, worked out from how rare fraud is), while the tuned model uses {0:1, 1:100}, chosen to follow the 60:1 dollar ratio of a $1,500 missed fraud to a $25 false alarm, rounded up to 100.
Learn it in 07 p5_02 GridSearchCV.
Conda environment¶
A separate Python setup with its own Python version and packages, so this project does not clash with other projects on your computer. The course uses one environment, mlops-env1, with Python 3.14: you create it once, then run conda activate mlops-env1 before running any script.
Learn it in 02 Setup Python Environment.
Confusion matrix¶
A 2x2 table that counts the four kinds of result: true negatives, false alarms (false positives), missed frauds (false negatives) and frauds caught (true positives). For the baseline on the 2,000 test transactions it shows 1,651 true negatives, 289 false alarms, 14 missed frauds and 46 frauds caught.
Learn it in 04 A v5 Evaluate and Metrics.
Cross-validation¶
A fairer way to score one set of settings: the training data is cut into parts called folds, the model is trained on all folds but one and scored on the fold left out, and this repeats so every fold is used once for scoring. The course uses 5-fold cross-validation (cv=5), so each combination of settings is trained 5 times and its 5 scores are averaged.
Learn it in 07 p5_01 RandomizedSearchCV.
Decision threshold¶
The probability cut-off that turns the model's fraud probability into a FRAUD or LEGITIMATE answer. Both course APIs use 0.5; the tuned model catches more fraud because of its class_weight, not because of a lower threshold.
Learn it in 08 Tuned Inference API.
EDA (Exploratory Data Analysis)¶
Studying the data with numbers and plots to find patterns before you try to improve the model. In Section 05, p2_eda_base.py makes 6 plots and shows, for example, that fraud transactions average $1,034.33 while legitimate ones average $280.68.
Learn it in 05 EDA and Preprocessing.
F1 score¶
One number that combines precision and recall in a special average that stays low if either of them is low. The baseline F1 is 0.2329 and the tuned model's F1 falls to 0.0892 even though it saves more money, which is why the course judges models by Net Benefit.
Learn it in 04 A v5 Evaluate and Metrics.
False alarm (false positive)¶
An honest transaction that the model flags as fraud. Each one costs $25 of review time: the baseline makes 289 false alarms and the tuned model 1,161, out of 1,940 honest test transactions.
Learn it in 04 A v5 Evaluate and Metrics.
FastAPI¶
A Python web framework for building APIs. The course uses it, with Uvicorn as the server and Pydantic to check the incoming data, to turn the saved model into a live API with /inference, /health, /docs and /ui endpoints.
Learn it in 04 B Inference API.
Feature engineering¶
Creating new input columns (features) from the data you already have, so the model can learn better. In Section 06 we add amount_ratio, going from 8 to 9 features, and Net Benefit rises by only $75, from $39,625 to $39,700.
Learn it in 06 Feature Engineering.
GridSearchCV¶
A scikit-learn tool that tries every combination of settings in a list (a grid) and scores each one with cross-validation. In p5_02 it tests 60 combinations with 5 folds each (300 fits), picks class_weight={0:1, 1:100} and reaches a Net Benefit of $50,550.
Learn it in 07 p5_02 GridSearchCV.
Hyperparameter tuning¶
Hyperparameters are settings you choose before training, such as C, solver, max_iter and class_weight in Logistic Regression, and tuning means searching for the values that work best. In Section 07 each search is scored in dollars (Net Benefit), not by F1.
Learn it in 07 Hyperparameter Tuning.
Inference API¶
A web service that loads the trained model and returns a prediction for each new transaction you send it. The course builds two, the baseline API on port 8000 and the tuned API on port 8001, and each answers FRAUD or LEGITIMATE with a fraud probability at POST /inference.
Learn it in 04 B Inference API.
Logistic Regression¶
The machine learning algorithm behind every model in this course. It learns from the input features and gives each transaction a fraud probability from 0.0 to 1.0.
Learn it in 04 A Train Baseline Model.
MLOps¶
The layer of work after the core machine learning job: running the model on infrastructure, monitoring it and retraining it, with tools such as MLflow, DVC, Docker and Kubernetes. This course explains these ideas but does not build them; it stops at the API.
Learn it in 00 Introduction.
Net Benefit¶
The course's business metric: the money a model saves the bank on the 2,000 test transactions. It is (Fraud Caught x $1,475) minus (False Alarms x $25) minus (Fraud Missed x $1,500), which gives $39,625 for the baseline and $50,550 for the tuned model.
Learn it in 04 A v5 Evaluate and Metrics.
OneHotEncoder¶
A scikit-learn tool that turns a text column into number columns, one 0 or 1 column for each category, because the model works only with numbers. The course uses it on the 3 text columns: merchant_category, card_present and international.
Learn it in 04 A Train Baseline Model.
Pickle file (.pkl)¶
Python's way of saving an object to a file so you can load it again later. The course saves the whole trained pipeline as model_latest.pkl (for example in models/p3_01_baseline/), and the inference API loads that file to make predictions.
Learn it in 04 A v6 Save Pipeline.
Pipeline (scikit-learn)¶
One scikit-learn object that joins the preprocessing (OneHotEncoder and StandardScaler) and the model (Logistic Regression), so one fit() call trains everything and one predict() call runs everything. This keeps the steps in the right order and makes the model easy to save and serve as a single file.
Learn it in 04 A v4 Create and Train Pipeline.
Precision¶
Of all transactions the model flags as fraud, the share that really are fraud. The baseline precision is 0.1373 (13.7%), which looks bad, but each false alarm costs only $25, so the model still earns $39,625.
Learn it in 04 A v5 Evaluate and Metrics.
predict_proba¶
A scikit-learn method that returns probabilities instead of a hard 0 or 1 answer; in the course, predict_proba(X_test)[:, 1] gives the fraud probability from 0.0 to 1.0. The predict() method uses the default threshold of 0.5 on these probabilities to give the final 0 or 1.
Learn it in 04 A v5 Evaluate and Metrics.
RandomizedSearchCV¶
A scikit-learn tool that tries only a random sample of setting combinations and scores each one with cross-validation. In p5_01 it tries 20 of 180 combinations (100 fits), but its class_weight choices are too narrow, so Net Benefit falls to $37,025, which is $2,675 less than in Section 06.
Learn it in 07 p5_01 RandomizedSearchCV.
Recall¶
Of all real frauds, the share the model catches. The baseline catches 46 of 60 test frauds (0.7667, or 76.7%) and the tuned model 57 of 60 (0.95), and recall matters most here because a missed fraud costs $1,500.
Learn it in 04 A Train Baseline Model.
ROC AUC¶
A score that shows how well the model ranks fraud above legitimate transactions, using its fraud probabilities, not the final 0 or 1 answers. The baseline scores 0.8837: pick one random fraud and one random legitimate transaction, and 88.4% of the time the model gives the fraud the higher score.
Learn it in 04 A v5 Evaluate and Metrics.
StandardScaler¶
A scikit-learn tool that puts number columns on a common scale, so big numbers such as transaction_amount do not get unfair weight. The course uses it on the 5 number columns, such as transaction_amount and transaction_hour.
Learn it in 04 A Train Baseline Model.
Synthetic data¶
Data made by a program instead of collected from real customers; the course makes its own to avoid licensing issues and to build in realistic fraud patterns. In Section 03, p1_01_generate_initial_dataset.py creates 10,000 credit card transactions with a fraud rate of 2.98%.
Learn it in 03 Generate Synthetic Dataset.
Train/test split (stratified)¶
Dividing the data into a training part the model learns from and a test part it never sees, so you can check the model fairly. The course splits the 10,000 transactions 80/20 (8,000 train, 2,000 test) with stratify=y, so both parts keep about 3% fraud.
Learn it in 04 A v3 Split Train/Test.