To analyze a dataset from banking I have both numerical and categorical values. I transform them to analyze with k-prototypes.

The original dataset:

enter image description here

The modified dataset:

  • E.g.: Job (for 1 to 12 'cos there are 12 levels)

enter image description here

Should I scale the dataset before doing the k-prototypes?

How could I determine the optimal "k" to choose (coding)?

I thought to execute:


lbd <- lambdaest(BPor)

kpres <- kproto(BPor, 5, lambda = lbd) #Change '5' for every possible value of k.


And then, calculate the sum of within cluster error (choosing the little one).

  • 1
    $\begingroup$ Duplicate of: stats.stackexchange.com/q/293877/7828 $\endgroup$ Aug 18, 2017 at 6:15
  • $\begingroup$ @Anony-Mousse Not from the same user, and not even a cross-post. So, shouldn't be closed with that reason $\endgroup$
    – Dawny33
    Aug 18, 2017 at 7:30
  • $\begingroup$ How do you calibrate lambda coefficient in K-prototypes algorithm in R ? Any gridsearch possible with variation of K and lambda (Let's say I want 100 different lambda values and varying number of clusters K from 2 to 15) and then compare compactness of clusters ? $\endgroup$
    – mdimp
    Oct 6, 2021 at 10:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy