# Using decision tree for unsupervised discretization?

I want to discretize a continuous variable $$X$$ into a given number of classes $$k$$ (assume for simplicity that $$k$$ is even).

Decision trees (and related methods) are already used to discretize a variable in a supervised context, but I find nothing regarding decision trees in an unsupervised context (in the sense of Kohavi et al.). The idea is simply to build a regression tree model where the target and the input are the same, i.e. $$y=X$$. This should result in subgroups (from which I derive the classes) which maximize the between-group variance.

Yet, I feel like I'm missing something obvious since the method is not being used anywhere. The module sklearn.preprocessing proposes methods based on K-means, on the distribution of the variable, on the range of the variable but nothing regarding decision trees.

Edit. Here is an example : Suppose I'm trying to predict the popularity of a set of articles for a press company. The popularity is captured by the number of shares on social networks, so it's a continuous variable. The company wants me to discretize the number of shares in order to get 4 classes (from very popular to not popular at all) before moving on to prediction because it is more readable from a business point of view. Can decision trees be of any help in achieving this goal?

• Please say more in your question about why you want to do this. It is generally not a good idea.
– EdM
Sep 25 '20 at 15:04
• CART (classification and regression tree) models are known weak learners. They have bias, they can be misled. They have issues. An ensemble of CART models, aka a Random Forest, is a much better tool for avoiding the pathologies of single CART models. If you are looking for clustering, using gaussian mixtures isn't a bad idea, and should be a built-in. Sep 25 '20 at 17:10
• Why not bin each continuous variable into 4 categories of equal frequency size? - Why are talking about decision tree which is a supervised method? Sep 25 '20 at 17:18