Binning numeric values

The final and most important transformation is quantile binning. The goal with quantile binning is to transform a numeric variable into a categorical one in order to better extract the relation between the variable and the prediction target. This is particularly useful in the presence of nonlinearities between a variable and the target. By splitting the original numeric variables values into n bins of equal size, it is possible to substitute each value by a corresponding bin. Since the number of bins is finite (from 2 to 1,000), the variable is now categorical. Syntax is quantile_bin(var, N) with N the number of bins.

There are two types of unsupervised binning, equal frequency and equal width binning. In equal frequency, ...

Get Effective Amazon Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.