Some algorithms, for example, the Naive Bayes algorithm that will be introduced in Chapter 8, use discrete input variables only. If you want to use a continuous variable in your analysis, you have to discretize it, or bin the values. You might also want to discretize a continuous variable just to be able to show its distribution with a bar chart. There are many possible ways to do the discretization. I will show the following ones:
- Equal width binning
- Equal height binning
- Custom binning