0
$\begingroup$

I need some help converting this issue into a machine learning problem.

Goal:

Grouping credit charges into clusters of recurring transactions per user

Input data:

  • List of credit card charges with
    • tx_id, username, amount, date, transaction_name,merchant_id
    • also manually labeled data of cluster_ids that group certain transactions together that can be used for supervised learning

Example

tx_id username amount date transaction_name merchant_id cluster_id
tx_1 user123 9.99 8/1/23 Amazon Coffee Sub amazon user123_999
tx_2 user123 27.99 8/10/23 Amazon Dog Food Sub amazon user123_2799
tx_3 user123 9.99 9/1/23 Amazon Coffee Sub amazon user123_999
tx_4 user123 27.99 9/10/23 Amazon Dog Food Sub amazon user123_2799
tx_5 user123 35.55 9/15/23 Amazon One Off purchase amazon null
tx_6 user567 12.99 8/2/23 Amazon Tea Sub amazon user567_999
tx_7 user567 25.99 8/16/23 Amazon Cat Food Sub amazon user567_2799
tx_8 user567 12.99 9/2/23 Amazon Tea Sub amazon user567_999
tx_9 user567 25.99 9/16/23 Amazon Cat Food Sub amazon user567_2799
tx_10 user567 45.55 9/21/23 Amazon One Off purchase amazon null

Ideal Output:

Some way of saying that the following transactions should be "clustered"

  • tx_1, tx_3
  • tx_2, tx_4
  • tx6, tx_8
  • tx_7, tx_9

Questions / thoughts

  • I've looked into k-means and other clustering models but wasn't sure if it's the right approach
    • The k number can be different per user per merchant
    • Some username, merchant combinations may be be super clean (same amount happening exactly 1 month apart) and all belong to one cluster
    • Each "cluster" should always have one only unique username, merchant. In other words, I don't want to group all amazon coffee subscriptions for all users into one cluster. I want a different cluster per user
    • I do have labeled data that can be used for supervised learning
  • Supervised classification algorithms
    • Same issue with k-means, user123 and user567 shouldn't have any cluster overlaps
    • There are no pre-defined "cluster_ids" (or lables) found in the training set that would appear in the output of the test set

Put in a different way, I want to build a model that can learn specific characteristics of what a recurring "cluster" should look like such as

  • amount similarity
  • charge date similarity (eg. always happening on the 1st of the month)

and share the learnings across different users. Once I have the model and pass in two transactions that are exactly a month apart with similar amounts for the same username/merchant, I would like the model to tell me that those two transactions should be considered a "cluster".

$\endgroup$

0

Your Answer

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