Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Machine Learning End-to-End: Credit Card Fraud Detection
Hot & New
New
Rating: 5.0 out of 5(2 ratings)
129 students

Machine Learning End-to-End: Credit Card Fraud Detection

Build a real fraud model in Python: EDA, feature engineering, training, business-metric tuning, a FastAPI inference API
Last updated 10/2026
English
English [Auto],

What you'll learn

  • Build a credit card fraud detection model in Python, end to end: generate data, train the model with scikit-learn, improve it, and serve it with FastAPI.
  • Learn machine learning by doing: run the working fraud project first, then rebuild its training script and API in small steps, in Python files, not notebooks.
  • Understand why accuracy can mislead when fraud is rare, about 3 in 100 transactions, and judge every model by Net Benefit: its value in dollars to a bank.
  • Learn the full machine learning workflow on one complete project: data, analysis, features, training, evaluation, tuning, and serving, one stage at a time.
  • 00. Introduction: Watch the finished fraud API label example transactions, learn why each model is judged in dollars, and see which script does each step.
  • 01. Machine Learning Fundamentals: Understand artificial intelligence, then walk through each workflow stage, from collecting data to retraining a live model.
  • 02. Python Environment Setup: See why projects need separate environments, install Miniconda, set up a conda environment, and add exact package versions.
  • 03. Synthetic Dataset Generation: Review a script that builds fraud patterns and noise into synthetic card data, then run it to create 10,000 transactions.
  • 04 A. Model Training and Evaluation: Train a logistic regression model in a scikit-learn Pipeline, check precision, recall, and Net Benefit, then save it.
  • 04 B. Model Serving - Inference API: Serve the model with FastAPI, check input with Pydantic, return a fraud label and risk level, and test it in Swagger.
  • 05. Exploratory Data Analysis: Measure class imbalance, read box plots and a correlation heatmap, run two automated report tools, and find a new feature idea.
  • 06. Feature Engineering: Code a feature that compares each purchase with the customer's average spend, check it with charts, retrain, and measure its effect.
  • 07. Hyperparameter Tuning: Use RandomizedSearchCV and GridSearchCV with 5-fold cross-validation and a custom scorer that ranks settings by Net Benefit.
  • 08. Model Serving - Tuned Inference API: Run the tuned model in a second FastAPI app, send it the same test transactions, and see which decisions change.
  • Course Project - Credit Card Fraud Detector: Start with a baseline model and API, then add a feature, tune the model, and serve it from a second local API.

Course content

10 sections • 92 lectures • 15h 8m total length
  • Step-01: Introduction29:55
  • Step-02: Before You Start1:14

Requirements

  • Python Basics: You need only basic Python. Each piece we write, from defining a function to classes, if/else, and f-strings, is explained as we code it.
  • New to Python: Consider our course "Python for Absolute Beginners: From Zero to Real Projects" first.
  • Terminal: Open a terminal, change folders, run a Python script, and use two terminals at once. Every command is shown in the videos or the READMEs.
  • Machine Learning: No experience is needed. Each idea is explained with the project's own numbers. The math is arithmetic, percentages, and simple statistics.
  • Computer: A Mac, Windows PC, or Linux machine with at least 3 GB of free disk space. No GPU is needed.
  • Internet Connection: Needed to get the code, install Miniconda and the packages, and load the Swagger docs page. Training and the API calls work offline.
  • Python and Editor: No need to install Python first. In Section 02, we install Miniconda and create a conda environment together. VS Code or any editor works.
  • Cost: Every tool and package is free for individual learners. You do not need a cloud account, an API key, a paid service, or a credit card.

Description

Learn machine learning end to end by building one complete credit card fraud detection project in Python, through 15 hours of video.

This course is for DevOps, SRE, and cloud engineers moving into machine learning, as well as developers, students, and Python learners ready for their first machine learning project. You need Python basics, but no machine learning experience. We build a working model and API first, then explore the data and improve the model.

What You'll Learn

  1. Introduction
    See the fraud detector you will build, why business value matters when evaluating a model, and the steps a typical machine learning project follows.

  2. Machine Learning Fundamentals
    Learn what AI and machine learning are, each stage of the machine learning workflow from data collection to monitoring, and how our fraud detection project follows it.

  3. Python Environment Setup
    Install Miniconda, create a Python conda environment, and install the version-locked course packages.

  4. Synthetic Dataset Generation
    Run a ready-made script that creates 10,000 synthetic card transactions with built-in fraud patterns.

  5. Model Training and Evaluation
    Build the training script in 7 small versions: split the data, train a scikit-learn Pipeline, evaluate it with technical and business metrics, and save the model.

  6. Model Serving: Inference API
    Wrap the saved model in a FastAPI inference API with input validation, then test it from the Swagger docs, a web page, and a Python script.

  7. Exploratory Data Analysis
    Study class imbalance, fraud patterns, and correlations with charts and two automated EDA tools, then use what you discover to identify an idea for a new feature.

  8. Feature Engineering
    Live-code a new feature that shows how unusual a purchase is for each customer, then retrain the model and compare it with the baseline.

  9. Hyperparameter Tuning
    Tune the model with RandomizedSearchCV, GridSearchCV, and 5-fold cross-validation, using a custom business scorer that ranks each candidate by the dollars it saves.

  10. Model Serving: Tuned Inference API
    Serve the tuned model through a second API, compare its decisions with the baseline on the same request, and recap what you built.

Build One Fraud Detection Project, Piece by Piece

  1. Part 1 - Training Pipeline Script
    A plain Python script that trains, evaluates, and saves your model.

  2. Part 2 - Inference API with a Web Page
    An API that returns FRAUD or LEGITIMATE with a fraud probability and risk level, plus a web page to try it.

  3. Part 3 - Improved and Tuned Model
    A new feature inspired by your data analysis, plus a tuned model that beats the baseline on Net Benefit, our business metric in dollars.

  4. Part 4 - Tuned Inference API
    A second API that serves the tuned model, so you can compare its decisions with the baseline.

A Hands-On, Business-First Approach

After one theory section on the machine learning fundamentals, the whole course is one project that grows in every section. You'll run a working baseline first, then build it step by step in plain Python scripts, not notebooks.

Only about 3% of transactions are fraud, so accuracy alone can be misleading. That is why we evaluate the models using Net Benefit, a business-value metric expressed in dollars. You'll also see honest results: some steps help a lot, some help only a little, and one makes the result worse.

You'll learn why each step helps or hurts the model, not just which code to type.

Good to know

The data is synthetic, both APIs run on your own machine, and containers and cloud deployment are not part of this course. Model monitoring and retraining are explained as ideas only.

When you finish, you'll have built a tuned fraud detection model and served it through your own API.

If you know some Python and want a machine learning project you can build, run, and explain in business terms, this is your path from raw data to a working fraud detection API.

Who this course is for:

  • DevOps, SRE, and cloud engineers: Engineers who write Python scripts, are new to machine learning, and want to train and serve a model locally.
  • Software developers: Developers who know Python but have never trained a model and want to create one from scratch and put it behind a FastAPI endpoint.
  • Python learners ready for machine learning: People who know the Python fundamentals and now want one complete project that teaches it, one step at a time.
  • Computer science and engineering students: Students with some Python and no machine learning yet who hope to build one complete fraud detection project.
  • Learners ready to move past notebooks: People who have run machine learning code in notebooks and now want a working project built from plain Python scripts.
  • Business-minded coders: Coders who want models judged by the money they save, not accuracy alone, and want to understand which steps help and which hurt.
  • Future MLOps learners: People who plan to study MLOps later and first want a trained model and local API of their own to build on.