i have a training dataset with 25,000 different customers, each with a transaction history of 50-500 bank transactions (both deposits and withdrawals, the exact # varies across customers). each customer was given a loan (from 500-2000$), and they either defaulted or did not default on the loan (this information is given in the training set). the test set has around 15,000 different customers (not the same people as above), and i need to predict whether or not they will default based on their transaction history. there is also a string associated to each transaction giving the type of transaction (ie, were they buying beer, coffee, etc).

i'm wondering what is the best way to approach this problem from a machine learning perspective? ie, what model would be best to predict the probability of a customer defaulting on a loan based on their transaction history?

i'm thinking a neural network in keras would be the easiest approach, but i'm not sure how to train it due to the variable input size (different # of transactions per customer). also, i'm wondering if i should make use of the transaction type string, because that adds an entirely new element of difficulty (parsing the string and classifying it into high/low risk type transactions, etc)...unless there are libraries that can do this automatically..



1 Answer 1


Some context:
The problem you are trying to solve can be defined as a classification problem.
Where based on features $x^1...x^n$ we are trying to predict if $y$ is class $default$ or class $no$ $default$.
There are several algorithms that are able to learn the different functions between the features and the class, functions that can be used for prediction purposes.
Neural network is one such function.

Answering the question(s):

1) handling variable input size: this is common when looking at time based related data, where each instance might have different history length and or frequency.
One simple approach is deducing the feature space to the biggest common space(I.E, truncate the history lengths to shortest existing in all). Be aware that in this approach you wont use all of data you have.
Another approach is aggregating the history into one or more features: 'total deals', 'average deal amount', 'average time between deals', etc..

2) Handling the 'string' columns: This data can be probably treated as a categorical feature.
Encoding it into several different variables(each representing one(or more) possible value(s) this feature have) is a common way including it as a feature in the learning algorithms.

There are other methods handling each question, but these should be a good starting point.

  • $\begingroup$ thanks. yeah, i'm gonna try just computing stats on each customer's transaction history, and see how that goes. i'll ignore the categorical features for now, because that seems like a whole other can of worms. $\endgroup$ Commented Mar 3, 2019 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.