Skip to content

Decide which clients to call first ​

A bank runs a phone campaign to sell a term deposit, and its call centre can only make so many calls a day. This guide trains a Fione model that gives each client a probability of subscribing, so that the team can call the most promising clients first. It goes from the download of an open dataset to a curl call of the served model, and shows why one column of the data, the length of the call, has to be left out.

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 12% of the clients contacted in a campaign subscribed a term deposit. A bank that knows before it calls which clients are most likely to say yes can act on it:

  • call the most promising clients first, while the campaign lasts;
  • give its best agents the calls with the best chances;
  • call clients who are very unlikely to say yes less often, or not at all.

The model answers one question per client: will this client subscribe a term deposit? It returns a yes/no answer and, more usefully, the probability of yes, which is what a call list is sorted by.

Get the data ​

The data is the Bank Marketing dataset from the UCI Machine Learning Repository:

Attribution (UCI's citation): Moro, S., Rita, P., & Cortez, P. (2014). Bank Marketing [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C5K306. The notes that come with the file we use (bank-names.txt) ask users to cite another paper: S. Moro, R. Laureano and P. Cortez, "Using Data Mining for Bank Direct Marketing: An Application of the CRISP-DM Methodology", Proceedings of the European Simulation and Modelling Conference (ESM'2011), pp. 117–121, 2011. What we changed: we 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. The download holds two more zip files; the data used here is in bank.zip:

sh
curl -LO https://archive.ics.uci.edu/static/public/222/bank+marketing.zip
unzip bank+marketing.zip
unzip bank.zip

The first unzip gives bank.zip and bank-additional.zip; the second gives bank-full.csv, bank.csv and bank-names.txt. If unzip says "End-of-central-directory signature not found", the download failed and the file is not a zip: delete it and run curl again.

UCI describes four versions of the data. We use bank-full.csv: it has all 45,211 rows, while bank.csv is a random 10% of them, and it has only columns about the client and the calls. The files in bank-additional.zip (41,188 rows) add five national economic indicators, such as the employment variation rate, that we would have to explain as well, and some of their columns differ; UCI calls bank-full.csv the older version with fewer inputs.

bank-full.csv is a text file of 45,212 lines (a header and 45,211 rows) with 17 columns. Its columns are separated by semicolons (;), not commas, and text values are in double quotes; Fione reads it as it is. There are no empty cells. According to UCI, the data is about the phone marketing campaigns of a Portuguese bank, and the rows are in date order, from May 2008 to November 2010.

The data ​

ColumnWhat it holds
ageAge in years
jobType of job: admin., blue-collar, entrepreneur, housemaid, management, retired, self-employed, services, student, technician, unemployed, unknown
maritalmarried, single or divorced (divorced also means widowed)
educationprimary, secondary, tertiary or unknown
defaultHas credit in default? yes or no
balanceAverage yearly balance, in euros
housingHas a housing loan? yes or no
loanHas a personal loan? yes or no
contactHow the client was contacted: cellular, telephone or unknown
dayDay of the month of the last contact
monthMonth of the last contact, jan to dec (there is no year)
durationLength of the last contact, in seconds
campaignNumber of contacts with this client during this campaign, including the last one
pdaysDays since the client was last contacted in a previous campaign; -1 if never
previousNumber of contacts with this client before this campaign
poutcomeOutcome of the previous campaign: success, failure, other or unknown
yThe answer: yes if the client subscribed a term deposit, no if not

Each row is one client contacted in a campaign. According to the notes, more than one call to the same client was often needed: campaign counts those calls, and contact, day, month and duration describe the last one. The notes do not say whether the same client can appear in more than one row. Below, "a client" means one row.

y is yes for 5,289 of the 45,211 rows (11.7%). Two ordinary rows that ended in no, and one that ended in yes:

csv
"age";"job";"marital";"education";"default";"balance";"housing";"loan";"contact";"day";"month";"duration";"campaign";"pdays";"previous";"poutcome";"y"
58;"management";"married";"tertiary";"no";2143;"yes";"no";"unknown";5;"may";261;1;-1;0;"unknown";"no"
44;"technician";"single";"secondary";"no";29;"yes";"no";"unknown";5;"may";151;1;-1;0;"unknown";"no"
59;"admin.";"married";"secondary";"no";2343;"yes";"no";"unknown";5;"may";1042;1;-1;0;"unknown";"yes"

Before training, look at three things.

First, duration. 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? The length of a call is known only once the call is over, and by then the bank also knows whether the client said yes. The UCI dataset page says so plainly, in the duration row of its Variables Table:

Important note: this attribute highly affects the output target (e.g., if duration=0 then y='no'). Yet, the duration is not known before a call is performed. Also, after the end of the call y is obviously known. Thus, this input should only be included for benchmark purposes and should be discarded if the intention is to have a realistic predictive model.

The notes of the newer version in bank-additional.zip (bank-additional/bank-additional-names.txt) say the same; the notes of bank-full.csv itself (bank-names.txt) do not repeat it. In bank-full.csv, the last call lasted 426 seconds at the median for the clients who said yes, and 164 seconds for those who did not. A model that learns from duration would score well in training, but when you build a call list there is no call yet, so you have no duration to give it. We leave it out, and in Read the results show what happens when it is kept.

Second, the other columns about the call. contact, day and month describe the last call of the campaign, and campaign counts the calls with this client including that last one. The notes do not say whether the client gave the answer on that last call. Our reading is that they did, since a bank would stop calling once a client had answered; then the bank knows these values before that call: how it will call, on what day, and how many times it has called the client so far. On that reading we keep them. If you use the model that way, give campaign the count the call you are about to make would reach, not the count so far. pdays, previous and poutcome are about earlier campaigns, so they are known before any call of this one. With your own data, check when each of these is recorded: before the call you are scoring, and not filled in afterwards.

Third, the order of the rows and the value unknown. The rows are in date order, and the share of yes changes a lot along the file: about 3% in the first tenth of the rows, 47% in the last tenth. The file has no year, so month and day alone do not say when a call was made, but they still differ: 7% of the clients last called in May said yes, 52% of those last called in March. contact is unknown in all of the first 12,657 rows and in only 363 rows after them. unknown appears as a value in job, education, contact and poutcome, and the sources disagree on whether the data has missing values. The UCI page says "Has Missing Values? No", but its Variables Table marks contact, pdays and poutcome as having missing values; the notes of the newer version say that missing values in some categorical columns are all coded unknown; bank-names.txt says "None". Whether every unknown in bank-full.csv is a missing value is not stated. In poutcome, 36,954 of the 36,959 unknown values are clients never contacted before (pdays -1, previous 0), who have no earlier campaign to report. The sources also do not say what other in poutcome means. We leave these values as they are and let the model learn from them.

Prepare the CSV ​

bank-full.csv needs no conversion. Check it has 45,212 lines:

sh
wc -l bank-full.csv

If wc says it cannot open bank-full.csv, the second unzip (of bank.zip) was not run in this directory.

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 45,191 rows in train.csv:

sh
head -n 45192 bank-full.csv > train.csv
{ head -n 1 bank-full.csv; tail -n 20 bank-full.csv; } > new-clients.csv

The 20 clients set aside are the last of the file, last called on 16 and 17 November, and 15 of them said yes, far more than the 12% of the whole file. They are fine for trying predictions, but they are not a fair sample of all the clients.

Keep duration in both files: you will uncheck it in Fione, and the predictions page shows that the model does not use it.

Train the model ​

  1. On Projects, create a project (we named it bank-marketing) and open it.
  2. Press Upload training data, choose train.csv and press Upload and analyze. Data analysis shows 45,191 rows, 17 columns and 0% empty cells.
  3. Under What do you want to predict?, choose y. Fione sees two values in it and suggests Classification. It also says that, with 45,191 rows and 17 columns, it has set the maximum run time to 10 minutes.
  4. Under Which columns should the model learn from?, all 16 columns are checked; Fione does not flag duration. Uncheck duration. Fione reads age, balance, day, duration, campaign, pdays and previous as Number and the others, the yes/no columns among them, as Category.
  5. Keep Classification under Prediction type.
  6. Keep 10 min under Maximum run time.
  7. Press Run.

Data analysis for train.csv, with y to predict, duration unchecked, every other column as input, Classification and 10 min

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

Read the results ​

The Prediction summary of our run: 1 out of 5, right about 90% of the time against 88% for always guessing, with contact and month at the top of the most useful inputs

In our run:

  • Rating: 1 out of 5. "On rows it did not learn from, the model was right about 90% of the time. Always guessing the most common answer would be right 88% 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 5 models, 44 models tried, training time 8:15.
  • Most useful inputs: contact 17%, month 16%, poutcome 12%, balance 9%, housing 9%.

The rating and the guide judge the model by its share of right answers only. 88% of the clients said no, so a "model" that always says no is right 88% of the time and finds no client who will say yes. 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.900 and always guessing no is right for 88.3% of the training rows, so the model covers (0.900 − 0.883) / (1 − 0.883) ≈ 0.14 of that distance, under 0.2, where 2 stars begin (How is the rating calculated? on the summary gives the formula and the bands). The guide's advice fits a model that is meant to give the right yes/no answer. For a call list it is the wrong measure, and you do not need to change the target or the columns: what counts is whether the model puts the clients who will say yes 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.81 (0.5 is guessing, 1 is perfect): take one client who said yes and one who did not, and the model gives the one who said yes the higher probability about 81% of the time.
  • Top-10% lift 4.5: the 10% of clients the model rates most promising said yes 4.5 times as often as the average client: about 53% of them, against 12% of all clients. Those 10% hold about 45% of all the clients who said yes.
  • Confusion matrix: of the 5,274 clients who said yes, the model said yes for 1,471 (28%) and missed 3,803. Of the 39,917 who said no, it said yes for 723 (2%). Of the 2,194 clients it called yes, 1,471 (67%) did say yes (Precision 0.670).

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 a client who says yes about four and a half times as often as one that calls at random. It also misses most of those clients if you only look at its yes/no answer. These figures come from rows of the same data, set aside in turn while the models learn, and because no time order is set, Fione shuffles the rows before setting them aside, so each part holds clients from the whole of 2008–2010; on a later campaign the model may do less well (see the third model below). Before a bank relies on it, it should check the model on a campaign it has not learned from.

The yes/no answer is the more likely of the two (the model's Choosing the predicted class setting is Most likely class), so the model says yes only when it rates a yes more likely than not. A call centre does not have to use that cut-off. With a fixed number of calls a day, it can sort the clients by the probability and call from the top down.

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. How the client was contacted (contact) and the month of the call (month) come first, followed by the outcome of the previous campaign (poutcome), the balance (balance) and whether the client has a housing loan (housing). 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 month 17%, poutcome 12%, balance 12%, day 11%, contact 10%).

To see what duration does, we trained a second model in the same way with duration checked. It got 2 out of 5, right about 92% of the time, and ranked much better (AUC 0.94, Top-10% lift 5.6); duration came first among its most useful inputs, with 30%. Of the 5,274 clients who said yes it found 2,835, against 1,471 without duration. That model looks better only because it is told how long the call lasted, which is known after the call, together with the answer. It cannot be used to decide whom to call, so its scores say nothing about how well a call list would work.

contact and month lead the list, and both also follow the period of the campaigns: contact is unknown in all the early rows, and the share of yes by month ranges from 7% to 52%. To see how much the model relies on them, we trained a third model in the same way without contact, day and month (and without duration). It got the same 1 out of 5, right about 90% of the time, but ranked less well (AUC 0.76, Top-10% lift 4.1). Of the 5,274 clients who said yes it found 1,177, against 1,471 with those columns, and it said yes for 601 clients who said no, against 723. So in this data the three columns help the model. Part of that help may come from when each campaign ran rather than from something the bank can repeat, such as calling mobile phones; the data cannot tell the two apart. We keep them, since on our reading they are known before the call, but this is one more reason to check the model on a later campaign before relying on it.

Make predictions ​

Predict the 20 clients you set aside:

  1. On the Prediction summary, press Make predictions.
  2. Choose new-clients.csv and press Upload. Fione says that "new-clients" (20 rows) has every column the model needs, and marks duration and y as Not used by the model. Keep y checked under Columns in the result, so that you can compare each prediction with what happened.
  3. Press Predict. Predictions shows 20 rows × 20 columns and Download predict_new-clients.csv.

predict is the answer, and p_yes the probability of yes. Five of the 20 rows in our run:

Rowagejobpoutcomep_yespredicty (what happened)
175retiredfailure0.26noyes
328self-employedsuccess0.65yesyes
568retiredsuccess0.76yesyes
934blue-collarother0.38nono
1957blue-collarunknown0.05nono

The model said yes for 4 of the 20 clients, and all 4 said yes; they are the 4 clients whose previous campaign was a success. Sorted by p_yes, the top 5 clients all said yes, and the 5 who said no came 6th, 10th, 14th, 17th and 20th. The other 11 clients who said yes got a p_yes of 0.06 to 0.47 and a predict of no. These clients, from the end of the file, said yes far more often than the clients the model learned from, and its probabilities did not follow: they averaged 0.31, while 15 of the 20 said yes. The order of the list held up better than the probabilities themselves. 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 8.4%; age (value 75) raises the chance by 10.4 points, contact (value cellular) by 3.1, and poutcome (value failure) lowers it by 2.7 points; the other columns make up the rest, ending at 26.0%.

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:

sh
unzip fione-serving-y-model-2026-11-28-08-00-14.zip -d fione-serving-y-model-2026-11-28-08-00-14
cd fione-serving-y-model-2026-11-28-08-00-14
docker run --rm -p 8081:8080 -v "$PWD/model:/model:ro" ghcr.io/codelibs/fione-serving:snapshot

In another terminal, ask which columns the model expects:

sh
curl -s localhost:8081/model
json
{"names":["age","job","marital","education","default","balance","housing","loan","contact","day","month","campaign","pdays","previous","poutcome","y"],
 "domains":[null,["admin.","blue-collar","entrepreneur","housemaid","management","retired","self-employed","services","student","technician","unemployed","unknown"],["divorced","married","single"],["primary","secondary","tertiary","unknown"],["no","yes"],null,["no","yes"],["no","yes"],["cellular","telephone","unknown"],null,["apr","aug","dec","feb","jan","jul","jun","mar","may","nov","oct","sep"],null,null,null,["failure","other","success","unknown"],["no","yes"]],
 "responseColumn":"y","category":"Binomial","nclasses":2,"nfeatures":15, ...}

duration is not among the names: the model does not use it. Send rows 5 and 19 of new-clients.csv, one client who said yes and one who did not:

sh
curl -s -X POST localhost:8081/invocations -H 'Content-Type: application/json' -d '{"instances":[{"age":68,"job":"retired","marital":"married","education":"secondary","default":"no","balance":1146,"housing":"no","loan":"no","contact":"cellular","day":16,"month":"nov","campaign":1,"pdays":187,"previous":6,"poutcome":"success"},{"age":57,"job":"blue-collar","marital":"married","education":"secondary","default":"no","balance":668,"housing":"no","loan":"no","contact":"telephone","day":17,"month":"nov","campaign":4,"pdays":-1,"previous":0,"poutcome":"unknown"}]}'
json
{"predictions":[{"label":"yes","index":1,"class_probabilities":[0.23891617786208774,0.7610838221379123]},{"label":"no","index":0,"class_probabilities":[0.9470038467333884,0.05299615326661148]}]}

class_probabilities follow the classes of y in domains, no then yes, so the second number is the probability of yes: 0.76 and 0.05, the same as p_yes for these rows under Make predictions. A bank's system would send each client's figures, keep its own client number next to the answer, and sort its call list by that number.

Send default, housing and loan as the strings "yes" and "no", as in the CSV. In our run, sending them as JSON false instead of "no" gave no error but different probabilities (0.75 and 0.04). Adding duration and y to a row, or sending the numbers as strings such as "68", 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. Ask the tool to leave duration out of the inputs, as above. For a few clients, the predict tool takes rows like the two above and returns predict, p_no and p_yes for each. Called directly over MCP for the model trained above, it returned the same probabilities as the API above (0.76 and 0.05). 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.