we imagine partition of the input range for the feature (in this casethe numbers from - to into fixed number of bins--say data point will then be represented by which bin it falls into to determine thiswe first have to define the bins in this casewe'll define bins equally spaced between - and we use the np linspace function for thiscreating entrieswhich will create bins--they are the spaces in between two consecutive boundariesin[ ]bins np linspace(- print("bins{}format(bins)out[ ]bins[- - - - - herethe first bin contains all data points with feature values - to - the second bin contains all points with feature values from - to - and so on nextwe record for each data point which bin it falls into this can be easily computed using the np digitize functionbinningdiscretizationlinear modelsand trees