Rank card accounts by late-payment risk
A card issuer sees some of its clients miss a payment, and its collection team can only call so many of them early. This guide trains a Fione model that gives each account a probability of defaulting on next month's payment, so that the team can start with the riskiest. It goes from the download of an open dataset, an Excel file, to a curl call of the served model.
Starting Fione from the published images and the general serving steps are in the practical guides overview. This page shows what is particular to this use case.
The business question
In the data used here, about 22% of the clients defaulted on the next month's payment. An issuer that knows ahead of the due date which accounts are most at risk can act on it:
- remind or call the riskiest accounts first, before the payment is missed;
- offer those clients a payment plan early;
- leave the accounts that will pay anyway alone.
The model answers one question per account: will this client default on next month's payment? It returns a yes/no answer and, more usefully, the probability of yes, which is what a collection list is sorted by.
Get the data
The data is the Default of Credit Card Clients dataset from the UCI Machine Learning Repository:
- Page: https://archive.ics.uci.edu/dataset/350/default+of+credit+card+clients
- Creator: I-Cheng Yeh (2009)
- DOI: 10.24432/C55S3H
- Licence: Creative Commons Attribution 4.0 International (CC BY 4.0)
Attribution (UCI's citation): Yeh, I. (2009). Default of Credit Card Clients [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C55S3H. What we changed: we saved the Excel sheet as a CSV without its first row, and set the last 20 rows aside to try predictions on (see Prepare the CSV); no value was changed.
In an empty directory, download and unpack it:
curl -LO https://archive.ics.uci.edu/static/public/350/default+of+credit+card+clients.zip
unzip default+of+credit+card+clients.zipThe zip holds one file, default of credit card clients.xls (about 5.3 MB; the name has spaces in it). It is an Excel file in the older .xls format, not a CSV, and Fione takes CSV files. Its one sheet has two header rows: the first holds the codes X1 to X23 and Y, the second the column names. Below them are 30,000 rows and 25 columns, all whole numbers, and no empty cells. According to UCI, the data is about the default payments of credit card clients in Taiwan.
The data
| Column | What it holds |
|---|---|
ID | 1 to 30000, in file order (UCI gives no description) |
LIMIT_BAL | Amount of credit given, in New Taiwan dollars, including the client's family (supplementary) credit |
SEX | 1 male, 2 female |
EDUCATION | 1 graduate school, 2 university, 3 high school, 4 others |
MARRIAGE | 1 married, 2 single, 3 others |
AGE | Age in years |
PAY_0, PAY_2 … PAY_6 | Repayment status in September (PAY_0), August (PAY_2), July, June, May and April 2005 (PAY_6): -1 paid duly, 1 one month late, 2 two months late, and so on up to 9 for nine months or more |
BILL_AMT1 … BILL_AMT6 | Bill statement amount, September (1) back to April 2005 (6) |
PAY_AMT1 … PAY_AMT6 | Amount paid, September (1) back to April 2005 (6) |
default payment next month | The answer: 1 if the client defaulted, 0 if not |
There is no PAY_1: the September status is PAY_0. UCI describes the repayment, bill and payment columns as covering April to September 2005 and the answer as "default payment next month"; it does not say more about which month that is or what counts as a default.
default payment next month is 1 for 6,636 of the 30,000 rows (22.1%). Three ordinary rows, a client who defaulted after paying late, and two who paid:
ID,LIMIT_BAL,SEX,EDUCATION,MARRIAGE,AGE,PAY_0,PAY_2,PAY_3,PAY_4,PAY_5,PAY_6,BILL_AMT1,BILL_AMT2,BILL_AMT3,BILL_AMT4,BILL_AMT5,BILL_AMT6,PAY_AMT1,PAY_AMT2,PAY_AMT3,PAY_AMT4,PAY_AMT5,PAY_AMT6,default payment next month
1,20000,2,2,1,24,2,2,-1,-1,-2,-2,3913,3102,689,0,0,0,0,689,0,0,0,0,1
3,90000,2,2,2,34,0,0,0,0,0,0,29239,14027,13559,14331,14948,15549,1518,1500,1000,1000,1000,5000,0
4,50000,2,2,1,37,0,0,0,0,0,0,46990,48233,49291,28314,28959,29547,2000,2019,1200,1100,1069,1000,0Before training, look at three things.
First, the codes. SEX, EDUCATION, MARRIAGE and the PAY_ columns hold numbers that stand for categories or statuses, and the file uses values that UCI does not describe. Over half of the values in the PAY_ columns are 0 (95,919 of 180,000), and another 24,415 are -2; neither is on UCI's scale, and the columns never reach 9. EDUCATION has 0, 5 or 6 in 345 rows, and MARRIAGE has 0 in 54. The 1 ("one month late") is common in September (3,688 rows) but rare in the other months (28 rows in August, at most 4 in the months before). We do not know what these values mean, so we leave them as they are and let the model learn from them. With your own data, write down what each code means before you train.
Second, the timing. Whether to keep a column depends on two things: is the value known at the moment you predict, and is it computed from the outcome you are predicting? By UCI's description, the repayment status, bill and payment columns cover April to September 2005, before the "next month" whose payment is predicted; the credit limit, sex, education, marital status and age describe the client, and UCI does not say when they were recorded. None of them is described as computed from the outcome, so we keep them all. The September status (PAY_0) is the closest to the answer: of the clients one month or more late in September, 50% defaulted (3,429 of 6,818), against 14% of the others. With your own data, check that the latest status you feed the model is one you have before the payment you are predicting, and not one updated after it was missed.
Third, SEX, AGE, EDUCATION and MARRIAGE. They describe the client, not how the account is used. Whether an issuer may use them to decide whom to chase depends on its own rules and the law where it works. We keep them in the first run, and in Read the results show a second run without them.
Prepare the CSV
The Excel file has to become a CSV first. Python's standard library cannot read .xls files, so the command below runs a short Python script in a throwaway python container with the xlrd package, which reads them. You already need Docker to run Fione; the command also needs network access, to download the python:3.12-slim image the first time and to install xlrd into the throwaway container each time. It keeps the second header row as the CSV's header, writes every number without a decimal point, and saves the result as credit-card-clients.csv:
docker run --rm -i -v "$PWD:/data:ro" python:3.12-slim sh -c 'pip install -q --disable-pip-version-check --root-user-action=ignore xlrd==2.0.2 >&2 && python -' > credit-card-clients.csv <<'PY'
import csv, sys, xlrd
sheet = xlrd.open_workbook("/data/default of credit card clients.xls").sheet_by_index(0)
out = csv.writer(sys.stdout, lineterminator="\n")
for r in range(1, sheet.nrows): # the first row holds X1 to Y; the column names are in the second
out.writerow([int(v) if isinstance(v, float) else v for v in sheet.row_values(r)])
PY
wc -l credit-card-clients.csvwc should count 30001 lines (the header and 30,000 clients). If it counts 0, the conversion failed; the error is shown above it.
Then keep a few clients apart, so that you can later predict rows the model never learned from. Keep the header and the last 20 rows in new-clients.csv, and train on the other 29,980 rows in train.csv:
head -n 29981 credit-card-clients.csv > train.csv
{ head -n 1 credit-card-clients.csv; tail -n 20 credit-card-clients.csv; } > new-clients.csvOf the 20 clients set aside, 6 defaulted. The rows of the file are not in random order: the last 200 are all men (SEX 1), and so are the 20 set aside. They are fine for trying predictions, but they are not a fair sample of all the clients.
Keep ID in both files. The model does not use it (Fione unchecks it, see below), but it is the only way to match a prediction to an account.
Train the model
- On Projects, create a project (we named it
credit-default) and open it. - Press Upload training data, choose
train.csvand press Upload and analyze. Data analysis shows 29,980 rows, 25 columns and 0% empty cells. - Under What do you want to predict?, choose
default payment next month. Fione sees two values in it and suggests Classification, although they are written as numbers. - Under Which columns should the model learn from?, Fione has unchecked
ID, marked ID-like, with the reason "Looks like an ID: every value is different, so it cannot help predict." The other 23 columns are checked. Leave them as they are. Fione readsSEX,EDUCATION,MARRIAGE,PAY_5andPAY_6as Category and the others,PAY_0toPAY_4among them, as Number. It reads a column of whole numbers as a category when it has few different values:PAY_5andPAY_6have 10 in this file, the otherPAY_columns 11. We left that as it was. - Keep Classification under Prediction type.
- Under Maximum run time, choose 10 min (the default is 3 min; a longer run can find better models).
- Press Run.

When training ends, the page moves on to the Prediction summary.
Read the results

In our run:
- Rating: 1 out of 5. "On rows it did not learn from, the model was right about 82% of the time. Always guessing the most common answer would be right 78% of the time."
- Guide: "This model could not beat a simple guess yet. Check that the column to predict is the right one and that the input columns relate to it, then run again."
- About this model: a blend of 10 models, 70 models tried, training time 7:24.
- Most useful inputs:
PAY_023%,PAY_29%,LIMIT_BAL9%,PAY_36%,BILL_AMT15%.
The rating and the guide judge the model by its share of right answers only. 78% of the clients did not default, so a "model" that always says "pays" is right 78% of the time and finds no defaulter at all. The rating measures how far the model gets from that guess towards a perfect score. Unrounded, the model's Accuracy (on the Metrics tab, below) is 0.822 and always guessing "pays" is right for 77.9% of the training rows, so the model covers (0.822 − 0.779) / (1 − 0.779) ≈ 0.195 of that distance, just under 0.2, where 2 stars begin (How is the rating calculated? on the summary gives the formula and the bands). For a collection team, that is the wrong measure: what counts is whether the model puts the accounts that will default at the top of the list.
Press Open advanced details and open the Metrics tab. It shows the figures measured on rows the models did not learn from. In our run:
- AUC 0.79 (0.5 is guessing, 1 is perfect): take one client who defaulted and one who did not, and the model gives the one who defaulted the higher probability about 79% of the time.
- Top-10% lift 3.2: the 10% of clients the model rates most at risk defaulted 3.2 times as often as the average client: about 71% of them, against 22% of all clients. Those 10% hold about a third of all the clients who defaulted.
- Confusion matrix: of the 6,630 clients who defaulted, the model said
1for 2,433 (37%) and missed 4,197. Of the 23,350 who did not, it said1for 1,137 (5%). Of the 3,570 clients it called1, 2,433 (68%) did default (Precision 0.682).
So the model does not beat the simple guess by much on right answers, but it ranks: a team that calls the top 10% of its list reaches defaulters about three times as often as one that calls at random. It also misses most defaulters if you only look at its 0/1 answer. These figures come from rows of the same data, set aside in turn while the models learn; before an issuer relies on the model, it should also check it on later months of its own accounts.
The 0/1 answer is the more likely of the two (the model's Choosing the predicted class setting is Most likely class), so the model says 1 only when it rates a default more likely than not. A collection team does not have to use that cut-off. With a fixed number of calls a day, it can sort the accounts by the probability and call from the top down; or it can pick its own, lower cut-off to reach more of the clients who will default, at the cost of more calls to clients who would have paid.
Most useful inputs is captioned "The columns that moved the predictions most, as a share of all the columns' effect." Fione works this out on its own shortly after training (about 6 seconds after it in our run), by explaining the model's predictions on rows of the training data. The September repayment status (PAY_0) accounts for about a quarter of the effect, followed by the August and July status (PAY_2, PAY_3), the credit limit (LIMIT_BAL) and the September bill (BILL_AMT1). Until that explanation is done, the summary shows a different list instead, captioned "The columns the model relied on most, as a share of all it used." and based on the training's own measure; that list stays on the Importance tab (in our run PAY_0 28%, PAY_2 8%, LIMIT_BAL 6%, BILL_AMT1 6%, PAY_3 4%).
To see how much the model depends on the columns that describe the client, we trained a second model in the same way without SEX, EDUCATION, MARRIAGE and AGE. It got the same 1 out of 5, right about 82% of the time, and ranked about as well (AUC 0.79, Top-10% lift 3.2). Of the 6,630 clients who defaulted it found 2,404, against 2,433 with those columns, and it said 1 for 1,162 clients who did not default, against 1,137. So in this data the model loses very little without them: most of what it can tell comes from the other columns, the account's credit limit and its bill and payment history. An issuer that may not, or does not want to, use them can leave them out at little cost here.
Make predictions
Predict the 20 clients you set aside:
- On the Prediction summary, press Make predictions.
- Choose
new-clients.csvand press Upload. Fione says that "new-clients" (20 rows) has every column the model needs, and marksIDanddefault payment next monthas Not used by the model. Keep both checked under Columns in the result: they are copied next to the predictions, so you can tell which account each prediction is for and compare it with what happened. - Press Predict. Predictions shows 20 rows × 28 columns and Download predict_new-clients.csv.
predict is the answer, and p_1 the probability of default. Five of the 20 rows in our run:
| Row | ID | PAY_0 | LIMIT_BAL | p_1 | predict | default payment next month (what happened) |
|---|---|---|---|---|---|---|
| 1 | 29981 | 0 | 50000 | 0.12 | 0 | 0 |
| 2 | 29982 | 1 | 50000 | 0.48 | 0 | 0 |
| 3 | 29983 | 0 | 90000 | 0.17 | 0 | 1 |
| 12 | 29992 | 3 | 210000 | 0.90 | 1 | 1 |
| 18 | 29998 | 4 | 30000 | 0.59 | 1 | 1 |
Of the 6 clients who defaulted, 3 got a p_1 of 0.59 or more and a predict of 1; they are the top 3 of the 20 when sorted by p_1. The other 3 got 0.15 to 0.17 and were missed, among clients who paid. No client who paid got a predict of 1; the highest such p_1 was 0.48. Under the table, Why these predictions shows, for the first 5 rows, the columns that moved each prediction most. For row 1 it starts from an average prediction of 19.2%; LIMIT_BAL (value 50000) raises the chance by 3.8 points and PAY_0 (value 0) lowers it by 3.8 points, ending at 12.2%.
Serve it as an API
Under Serve it from your own system, press Download the serving bundle. Unpack it into a directory of its own and run the command shown on the card there, as in the overview. Use the name of your file; for our model:
unzip fione-serving-default-payment-next-month-model-2026-11-28-07-32-12.zip -d fione-serving-default-payment-next-month-model-2026-11-28-07-32-12
cd fione-serving-default-payment-next-month-model-2026-11-28-07-32-12
docker run --rm -p 8081:8080 -v "$PWD/model:/model:ro" ghcr.io/codelibs/fione-serving:snapshotIn another terminal, ask which columns the model expects:
curl -s localhost:8081/model{"names":["LIMIT_BAL","SEX","EDUCATION","MARRIAGE","AGE","PAY_0","PAY_2","PAY_3","PAY_4","PAY_5","PAY_6","BILL_AMT1","BILL_AMT2","BILL_AMT3","BILL_AMT4","BILL_AMT5","BILL_AMT6","PAY_AMT1","PAY_AMT2","PAY_AMT3","PAY_AMT4","PAY_AMT5","PAY_AMT6","default payment next month"],
"domains":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[0,1]],
"responseColumn":"default payment next month","category":"Binomial","nclasses":2,"nfeatures":23, ...}ID is not among the names: the model does not use it. Send rows 1 and 12 of new-clients.csv, one client who paid and one who defaulted:
curl -s -X POST localhost:8081/invocations -H 'Content-Type: application/json' -d '{"instances":[{"LIMIT_BAL":50000,"SEX":1,"EDUCATION":3,"MARRIAGE":2,"AGE":42,"PAY_0":0,"PAY_2":0,"PAY_3":0,"PAY_4":0,"PAY_5":0,"PAY_6":0,"BILL_AMT1":43998,"BILL_AMT2":49123,"BILL_AMT3":49397,"BILL_AMT4":50360,"BILL_AMT5":19971,"BILL_AMT6":19694,"PAY_AMT1":10000,"PAY_AMT2":4000,"PAY_AMT3":5000,"PAY_AMT4":3000,"PAY_AMT5":4500,"PAY_AMT6":2000},{"LIMIT_BAL":210000,"SEX":1,"EDUCATION":2,"MARRIAGE":1,"AGE":34,"PAY_0":3,"PAY_2":2,"PAY_3":2,"PAY_4":2,"PAY_5":2,"PAY_6":2,"BILL_AMT1":2500,"BILL_AMT2":2500,"BILL_AMT3":2500,"BILL_AMT4":2500,"BILL_AMT5":2500,"BILL_AMT6":2500,"PAY_AMT1":0,"PAY_AMT2":0,"PAY_AMT3":0,"PAY_AMT4":0,"PAY_AMT5":0,"PAY_AMT6":0}]}'{"predictions":[{"label":0,"index":0,"class_probabilities":[0.8781402274176499,0.12185977258235013]},{"label":1,"index":1,"class_probabilities":[0.09984356243762142,0.9001564375623786]}]}class_probabilities follow the classes of default payment next month in domains, 0 then 1, so the second number is the probability of default: 0.12 and 0.90, the same as p_1 for these rows under Make predictions. An issuer's system would send each account's figures, keep its own account number next to the answer, and sort its call list by that number.
In our run, adding ID to each row, or sending the values as strings such as "50000" as in the CSV, gave the same probabilities.
From an AI tool
AI tools such as Claude and Codex can do the same through Fione's MCP endpoint: upload the CSV, train, read the results and predict. Fione takes the CSV, not the Excel file, so convert it first as above. For a few accounts, the predict tool takes rows like the two above and returns predict, p_0 and p_1 for each. Called directly over MCP for the model trained above, it returned the same probabilities as the API above (0.12 and 0.90). How to connect a client and what to ask is in Run the AutoML loop from an AI tool with MCP, and the predict tool in Predicting new rows.