Skip to navigation

Credit Card Fraud Detection Solution

View as Markdown

Kumo’s temporal hetero-GNN combines transaction attributes with connected account and merchant histories. It learns relational fraud signals from labeled transactions, reducing the need for task-specific cross-table aggregates. The same architecture supports transaction scoring and predictions of future fraud at the card or merchant level.

Why the Temporal Graph Matters

Account neighborhoods capture changes in individual spending behavior. Merchant neighborhoods expose activity shared across cardholders. Multi-hop message passing combines these signals, so the model can learn patterns that span multiple transactions and entity types.

Temporal sampling separates the historical inputs from the outcome being predicted. Relative-time encodings preserve recency within that history. Together, they let the model learn how a pattern’s timing affects its relevance to a fraud decision.

A temporal subgraph around transaction v connects its card account to earlier transactions and merchants. Node encoders and GNN aggregation produce a representation of v, followed by a binary fraud prediction.

The classifier produces a fraud probability; the figure shows the binary decision after thresholding. See Temporal Hetero-GNN.

The Prediction Questions

The prediction entity determines the decision the model supports: reviewing an individual transaction, identifying a compromised card, or detecting merchant activity that affects multiple cardholders. Each question can reuse the same graph snapshot with its own target and trained model.

Tables used in the query examples

The queries assume a prepared Kumo Engine graph and matching snapshot with these tables:

TableColumns used hereRole
transactionstransaction_id, credit_card_id, merchant_id, timestamp, labelPayments made with a card at a merchant. label is 1 for fraud and 0 for a legitimate payment.
credit_cardscredit_card_idCard accounts, with attributes such as opening date and credit limit.
merchantsmerchant_idMerchants, with attributes such as category.

Transaction links identify the card and merchant, and timestamp places each payment in its history. See Train a Classification Model to learn more.

Score each transaction for fraud

Transaction scoring estimates the fraud risk of an observed payment using the account and merchant history available at its timestamp. The target transactions.label = 1 specifies binary classification; predicting the numeric label column directly would define a regression task.

from kumo.engine import PredictiveQuery
query_text = (
"PREDICT transactions.label = 1 "
"FOR EACH transactions.transaction_id"
)
query = PredictiveQuery(graph, query_text)
query.validate()
print(query.get_task_type()) # binary_classification

Predict future fraud on a card

Card-level prediction identifies accounts at risk of fraud before another payment is attempted. The target is positive if any fraudulent payment occurs during (t, t + 7 days], where t is the scoring time. The aggregation constructs that target from the transaction fraud labels.

query_text = (
"PREDICT SUM(transactions.label, 0, 7, days) > 0 "
"FOR EACH credit_cards.credit_card_id"
)
query = PredictiveQuery(graph, query_text)
query.validate()
print(query.get_task_type()) # binary_classification

Predict future fraud at a merchant

Merchant-level prediction supports decisions that apply across cardholders, such as prioritizing merchants for investigation. It combines evidence from transactions made with different cards and predicts whether the merchant will receive a fraudulent payment during (t, t + 30 days].

query_text = (
"PREDICT SUM(transactions.label, 0, 30, days) > 0 "
"FOR EACH merchants.merchant_id"
)
query = PredictiveQuery(graph, query_text)
query.validate()
print(query.get_task_type()) # binary_classification

Reading the predictions

Evaluate fraud recall at the false-positive rate or review volume the application can support. Keep evaluation chronological and report results separately for transaction, card, and merchant predictions. Their target populations and seven-day or 30-day horizons define different operating problems.