0
$\begingroup$

I have Data Frame where are continuous values Features present. I want to bin these Features in category. I am using KBinsDescretizer for this. To find the optimal number of bins i used Kmeans "Elbow-Method" and feed the output in n_bins in KBinsDescritizer.

But, is it the right method to find the perfect number of bins? I looked in internet and came across "Freedman-Diaconis" method and also some others like "Sturges's". But, these are used to find the optimal number of bins in histogramm.

What is the right way here? My Parameters in KBinsDescritizer are :

(n_bins=(func_kmeans_elbow_method) , encode='oridnal', strategy='kmeans')  # is it a good choice here to use 'kmeans' or 'quantile'

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.