Datasets

The bank marketing file

Before a telephone call is placed, how likely is this client to subscribe to a term deposit?

← All datasets and notebooks

Where it goes. Keep the file in a data folder beside the notebook. Every notebook reads data/bank.csv and is run from its own folder.

What this data answers

It answers who will say yes if contacted, as contacts happened historically. It does not answer who would say yes because of the call, because no client was deliberately left uncalled for comparison.

Dataset overview

QuestionBefore a telephone call is placed, how likely is this client to subscribe to a term deposit?
ObservationOne recorded contact with one client, from a campaign run between May 2008 and November 2010.
Targetsubscribed. 1 if the client subscribed to a term deposit, 0 otherwise.
Inputsage, job, marital, education, default, housing, loan, contact, month, day_of_week, campaign, pdays, previous, poutcome, emp_var_rate, cons_price_idx, cons_conf_idx, euribor3m, nr_employed
Size41,188 rows and 22 columns.
Held backduration, recorded only after the call ends, so it cannot inform the decision to call.

How the rows are divided

A stratified random split, so each group holds the same share of subscribers, 11.27 per cent. A later difference in scores therefore cannot be explained by one group simply containing more subscribers.

GroupRowsWhat you may do with it
fitting24,712estimate the model
checking8,238compare finished models, once each
final8,238opened once, after every choice is frozen

Data dictionary

Every column in bank.csv. The fourth column is the one to read before modelling: a variable that is not known when the prediction is needed cannot be used, however well it predicts.

ColumnTypeWhat it meansWhen is this known?
splitcategoryfitting, checking, or final.Added for this course. Not part of the published data.
agewhole numberClient age in years.Known before the call.
jobcategoryOccupation. 12 levels including unknown.Known before the call.
maritalcategoryMarital status.Known before the call.
educationcategoryHighest education recorded.Known before the call.
defaultcategoryHas credit in default: yes, no, or unknown.Known before the call.
housingcategoryHas a housing loan.Known before the call.
loancategoryHas a personal loan.Known before the call.
contactcategoryContact channel: cellular or telephone.Chosen before the call is placed.
monthcategoryMonth of the contact.Known when the call is scheduled.
day_of_weekcategoryWeekday of the contact.Known when the call is scheduled.
durationwhole number, secondsCall length in seconds.ONLY AFTER THE CALL ENDS. It cannot inform the decision to call, so every model on this course excludes it.
campaignwhole numberContacts made to this client during this campaign, including this one.Known before the call.
pdayswhole numberDays since the client was last contacted. 999 means never contacted before.Known before the call. Treat 999 as a category, not a long gap.
previouswhole numberContacts made to this client before this campaign.Known before the call.
poutcomecategoryOutcome of the previous campaign.Known before the call.
emp_var_ratenumberEmployment variation rate, quarterly.Describes the month, not the client. Shared by every contact that month.
cons_price_idxnumberConsumer price index, monthly.Describes the month, not the client.
cons_conf_idxnumberConsumer confidence index, monthly.Describes the month, not the client.
euribor3mnumberThree-month euribor rate, daily.Describes the market, not the client.
nr_employednumberNumber of employees, quarterly.Describes the economy, not the client.
subscribed0 or 1 (target)1 if the client subscribed to a term deposit.The final outcome. Known only after the call has been made and answered.

Source and preparation

The source is UCI Machine Learning Repository, Bank Marketing (bank-additional-full), a Portuguese bank's campaigns, May 2008 to November 2010, released under CC BY 4.0. S. Moro, P. Cortez and P. Rita (2014), 'A data-driven approach to predict the success of bank telemarketing', Decision Support Systems 62. DOI 10.24432/C5K306.

All 41,188 rows are kept and no row is filtered. Three changes were made to the published file, all of them cosmetic or explanatory.

StepRows leftWhy
Published rows41,188every recorded contact is used
Column names41,188full stops became underscores, so emp.var.rate is emp_var_rate
Outcome column41,188the yes/no column y became a 0 or 1 column named subscribed
Separator41,188the original is semicolon-separated; this copy is an ordinary comma CSV

4,640 of the 41,188 contacts ended in a subscription, so the base rate is 11.27 per cent. That number is the benchmark every model has to beat, and a rule that says no to everybody is already 88.74 per cent accurate.

What this data does not establish

  • Call duration correlates with the outcome at 0.41 and is unusable. A highly predictive variable can still be an invalid input; the test is whether it exists at the moment the decision is made.
  • In pdays, 999 is not a long gap. It is a different category, and it covers 96.3 per cent of rows.
  • The five economic columns describe the month, not the client. Every contact in the same month shares them.
  • The file records only clients the bank chose to call, so it cannot identify who subscribes because of a call.

Where it is used

  • Day 1b. Day 1b uses it for baselines, the confusion matrix, thresholds and both kinds of leakage.
  • Day 2. Day 2 fits logistic regression on it, scores it with log loss, and prices the cut-off.
  • Day 3. Day 3 compares trees, forests and boosting on it, and stress-tests it on later calls.
Oxford · United Kingdom Teaching CV
University of Oxford