I'm relatively new to the AI/ML space, but come from a programming background.
The problem: I have a dataset of users transactions who have taken short-term loans from a single loan provider and I need to match the loan repayments to a particular loan receipt.
The sample dataset is below:
transactionDate | amount | creditDebit
2017-09-01 | 500 | Credit
2017-09-08 | 250 | Debit
2017-09-17 | 294 | Debit
2017-12-11 | 300 | Credit
2017-12-15 | 150 | Debit
2018-01-07 | 200 | Credit
2018-01-12 | 398.8 | Debit
2018-01-19 | 200 | Debit
2018-02-02 | 150 | Debit
Here the 'Credit' values for creditDebit column indicate a received loan and 'Debit' indicates a repayment of some loan received previously.
As you can see the first 3 rows are pretty easy to match because there is 1 Credit (amount of 500) followed by 2 Debits (amounts 250 and 294).
From 4th row onward is where i cannot figure out how best to match.
- 2017-12-11 there is a Credit transaction for a loan
- 2017-12-15 is a partial repayment of this loan
- Then is another Credit for a new loan
- 2018-01-12 is a partial repayment for the 2 loans previously
- The final 2 Debits are partial repayments also
I have been able to manually determine which repayment makes most sense for which loan, but trying to write it out into an if-else function would be very hard in my opinion and not the best. For example the hardest part is to determine the Debit on 2018-01-12 which is a combined repayment transaction for both of the previously received loans. I have manually calculated a reasonable split of this Debit for the loans at 170 for the loan received on 2017-12-11 and 228 for loan on 2018-01-11.
Is there some model/algorithm that I could use to match which debit transactions are most likely to be repayments of which credit transactions and if the repayment transaction looks like a compound repayment of multiple previous loans - then what would be a reasonable split of the debit to satisfy the credit transactions?
I don't know if this makes sense to you..
I tried thinking about how I could use the clustering algorithms, but i don't I could since the clusters would not indicate matching of credit and debit transactions, especially the compound repayment debits.
Any ideas on how to tackles this are much appreciated!