washing-machineAutoML

Use PDI + H2O AutoML in Colab to prototype a credit-card fraud model.

circle-info

Imagine that a direct retailer wants to reduce losses due to orders involving fraudulent use of credit cards. They accept orders via phone and their website, and ship goods directly to the customer.

Basic customer details, such as customer name, date of birth, billing address and preferred shipping address, are stored in a relational database.

Orders, as they come in, are stored in a database. There is also a report of historical instances of fraud contained in a CSV spreadsheet.

circle-exclamation

Before you start ..

Walkthrough (video)
circle-info

In this workshop, you will:

  • Prepare data (wrangling).

  • Create features (feature engineering).

  • Use H2O AutoML to shortlist candidate models.

  • Train and evaluate a model in Colab.

  • Save the best model artifact.

AutoML
file-download
2MB
file-download
270KB
file-download
60KB

Run through the following steps to determine the best ML model for the dataset:

circle-info

Data preparation

Use PDI to join customer, transaction, and historical fraud data. Create a single training dataset for AutoML.

  1. Start PDI

  1. Open the transformation: autoML.ktr

~/Workshop--Data-Integration/Labs/Module 7 - Machine Learning/AutoML

data wrangling
  1. Browse the various customer data sources:

circle-info

Customer Data

Where you will find the customer_billing_zip codes, which will be used in feature engineering:

customer_data
chevron-rightMetrics cheat sheet (fraud detection)hashtag

Use these metrics to compare models and pick a decision threshold. Fraud data is usually highly imbalanced.

What to look at first

  • AUCPR: best single-number metric for imbalanced classification.

  • Recall: how much fraud you catch (minimize false negatives).

  • Precision: how many alerts are real fraud (minimize false positives).

Use AUC as a sanity check

AUC measures how well the model ranks fraud above legitimate transactions. It can look “good” even when precision is poor at useful thresholds.

Why accuracy is a trap

If fraud is 1% of transactions, a model can be 99% accurate and useless. It can do that by predicting “legitimate” for every row.

Practical selection guide

  • If fraud losses are expensive, prioritize recall.

  • If customer friction is expensive, prioritize precision.

  • Use AUCPR to compare candidates before tuning thresholds.

What to ignore (most of the time)

  • RMSE/MSE: regression-style errors on probabilities. Not decision-friendly here.

Last updated

Was this helpful?