Logistic regression on a 100,000-row sample of the credit-card fraud table. Every fraud row is kept, Time stays out, the hold-out is stratified, and class weight is balanced.
The same graph as the diagram below, on a sample that keeps every fraud row. The table page is Credit Card Fraud.
Transcript
The question is which card transactions are fraud. Class 1 is fraud. Almost every row is a legitimate transaction, so a high accuracy can still mean the model misses the frauds, or that it floods the alerts with false alarms.
The Data Loader is the node that places a dataset on the canvas. It sits under Data Source. This run uses the credit-card sample that keeps every fraud row.
One hundred thousand transactions. Time, amount, and the V columns are in the table. The V columns are already principal components. Class is the label, and 1 means fraud. The sample keeps every fraud row from the full table.
The Target Selector marks the column to predict. Without it, the model has no answer column. The target is Class. Drop a node and it wires to the one before it.
Time is a clock across the two days in the file. It is not a property of the card transaction. Left in, the model can lean on when the frauds happened to sit in the file. Time stays out. Amount stays in. Amount is currency, and the model will standardise the train rows itself.
Train/Test Split holds 20 percent back. Stratify is on, so the fraud share stays about the same in the hold-out. Fraud is rare. Without stratify, the hold-out can lose almost all of the fraud rows. The seed is 42. The scores that follow are on the transactions the model did not train on.
Logistic regression estimates the chance a transaction is fraud. There is no scaler node. Amount is in currency, so the model standardises the train rows itself. C stays at 1. Class weight is set to balanced. Fraud is a small fraction of the rows. With the weight off, the fit can ignore those rows and still look accurate. Balancing makes a missed fraud cost more during the fit. That raises recall, and it spends precision: more of the alerts are false alarms.
Three nodes read the hold-out. Metrics gives accuracy and the scores for each class. Accuracy is the wrong headline on a table this unbalanced. The confusion matrix counts the frauds that were caught and the legitimate transactions that were flagged. The ROC curve can look strong when fraud is rare. Average precision, and the fraud row of the matrix, say whether the alerts are usable.
The chain is on screen. Data loader, the target with Time removed, the stratified split, logistic regression with a balanced class weight, then the three evaluation nodes.
Run. One hundred thousand transactions, so this takes a moment.
The hold-out has 98 frauds out of 20,000 transactions. That is 0.49%. A model that calls every transaction legitimate would be right 99.51% of the time. Accuracy here is 97.94%, which is lower than that. The balanced weight spends accuracy in order to catch fraud. For fraud, precision is 17.83%. When the model raises a fraud alert, that share of the alerts are real frauds, and the rest are legitimate transactions. Recall is 88.78%. The model catches that share of the frauds in the hold-out, and the rest go through. F1 is 29.69%. It is low because precision is low. ROC-AUC is 0.9760. A fraud tends to receive a higher score than a legitimate transaction. Average precision is 0.8403. It sits far above the 0.49% base rate, and it is the number that says how the alerts behave across the whole recall range. These scores are on the transactions the model did not train on.
The confusion matrix is open. Rows are the actual class. Columns are the prediction. Class 1 is fraud. Of the legitimate transactions, 19,501 were called legitimate and 401 were false alarms. Of the frauds, 11 were missed and 87 were caught. The false alarms outnumber the caught frauds, which is why precision is 17.83%. The missed count is why recall is 88.78% and not every fraud.
The ROC curve and the precision-recall curve are open. ROC-AUC is 0.976 and average precision is 0.840. A rare class can post a high ROC-AUC while most alerts are still false alarms. Average precision is the curve that shows that gap. The recall of 88.78% says most of the frauds were caught. The precision of 17.83% says each catch comes with several false alarms.
Pipeline Stages
Data Loader
Target Selector
Train/Test Split
Logistic Regression
Metrics
Confusion Matrix
ROC / PR Curve
Data Loader. Loads the Credit Card Fraud dataset (100000 samples, 31 features). Source: Worldline and the ULB Machine Learning Group, Kaggle mlg-ulb/creditcardfraud. License: ODbL and DbCL.
Target Selector. Target column is Class. Time stays out.
Train/Test Split. Holds out 20,000 rows, 20 percent, seed 42, stratified. 98 of the hold-out rows are fraud.
Logistic Regression. C 1.0, lbfgs, class weight balanced. The node standardises the train rows because Amount is in currency.
Metrics. Hold-out accuracy 0.9794. For fraud, precision 0.1783, recall 0.8878, F1 0.2969.
Confusion Matrix. Rows are the actual class. Class 1 is fraud.
ROC / PR Curve. ROC-AUC 0.9760. Average precision 0.8403.
Overview
This pipeline loads a 100,000-row sample of the credit-card fraud table and predicts Class. The sample keeps all 492 fraud rows and fills the rest with legitimate transactions. The downloadable table is the full file, 284,807 rows. Time stays out. A seed-42 stratified split holds out 20,000 rows, including 98 frauds. Logistic regression uses C 1.0, the lbfgs solver, and balanced class weight.
Why This Pipeline Works
Class is 1 for fraud and 0 otherwise. A model that calls every transaction legitimate is right about 99.8 percent of the time on the full file, so accuracy is the wrong headline. On this hold-out that same call would be right 99.51 percent of the time, and the published accuracy of 97.94 percent is lower. The balanced class weight spends that accuracy to catch fraud. Balanced class weight keeps the 492 fraud rows from being ignored. Time is a clock across the two days in the file, not a property of the transaction, so it stays out. Amount is in currency, so logistic regression standardises the train rows itself. The question is the fraud row: precision, recall, F1, the confusion matrix, ROC-AUC, and average precision.
Expected Output
Hold-out accuracy is 0.9794 (97.94 percent). For fraud, precision is 0.1783 (17.83 percent), recall is 0.8878 (88.78 percent), and F1 is 0.2969 (29.69 percent), on 98 of 20,000 hold-out rows. ROC-AUC is 0.9760. Average precision is 0.8403. Of the 98 frauds, 87 were caught and 11 were missed. scikit-learn 1.4.2, computed on 2026-11-05.
Evaluation Metrics
Accuracy
0.9794 on the 20,000-row hold-out, below the 99.51 percent of calling every transaction legitimate
Fraud precision, recall, F1
0.1783, 0.8878, 0.2969 on the 98 frauds
ROC-AUC
0.9760
Average precision
0.8403
Confusion matrix
87 of 98 frauds were predicted fraud; 11 were predicted legitimate