0
$\begingroup$

I have a data set with transactions details from different business (roughly 1 thousand business entities). Each row is a transaction. The structure of the dataset is as follows:

client_id Sex Age transaction_ammount business_entity
123 M 88 4829 storeA
123 M 88 1049 storeB
255 F 25 1122 storeH

My goal is to cluster the clients depending on their consuming habits, age and sex.

I am having a hard time on deciding on the best features to feed this dataset into a clustering algorithm (probably K-means as a starter).

Some of the things I am planning to do are:

  • One hot encoding on: sex
  • Make each store be a column and each row value be the amount of transactions a certain user did pay to that store (for example, if user1 made two transactions to storeB, there will be a 2 in the user1 row on the storeB column).

One of the main things I am struggling with right now is how to sum the transactions data per user. I would need to run an aggregated operation on them, but don't know which one would be better. Some of the ones I have in my mind:

  • Average transaction amount per user
  • Min transaction amount per user
  • Max transaction amount per user
  • The above 3 but for each store per user (which would mean that, if I have 1000 stores, I would have to add 3000 thousand columns). This makes sense since each store have a wide range of product prices and running an operation among all the transactions of a user will be misleading.

What feature engineering technique would you recommend me? Is there any additional data wrangling I should do?

$\endgroup$

1 Answer 1

2
$\begingroup$

Depending on your processing limitations I'd be tempted to do the following, for each client a single row consisting of:

  • Age
  • Sex (one hot encoded)
  • Per store:
    • Purchase Count
    • Total Purchase Value
    • Average Purchase Value
    • Min Purchase Value
    • Max Purchase Value

Additionally if you have the transaction dates I'd try to include things like:

  • Days since first purchase
  • Avg. days between purchases

Hopefully that helps you a bit, good luck!

$\endgroup$

Your Answer

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

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