regression model and the decision tree make exactly the same predictions for each binthey predict constant value as features are constant within each binany model must predict the same value for all points within bin comparing what the models learned before binning the features and afterwe see that the linear model became much more flexiblebecause it now has different value for each binwhile the decision tree model got much less flexible binning features generally has no beneficial effect for tree-based modelsas these models can learn to split up the data anywhere in sensethat means decision trees can learn whatever binning is most useful for predicting on this data additionallydecision trees look at multiple features at oncewhile binning is usually done on per-feature basis howeverthe linear model benefited greatly in expressiveness from the transformation of the data if there are good reasons to use linear model for particular dataset--saybecause it is very large and high-dimensionalbut some features have nonlinear relations with the output--binning can be great way to increase modeling power interactions and polynomials another way to enrich feature representationparticularly for linear modelsis adding interaction features and polynomial features of the original data this kind of feature engineering is often used in statistical modelingbut it' also common in many practical machine learning applications as first examplelook again at figure - the linear model learned constant value for each bin in the wave dataset we knowhoweverthat linear models can learn not only offsetsbut also slopes one way to add slope to the linear model on the binned data is to add the original feature (the -axis in the plotback in this leads to an dimensional datasetas seen in figure - in[ ]x_combined np hstack([xx_binned]print(x_combined shapeout[ ]( in[ ]reg linearregression(fit(x_combinedyline_combined np hstack([lineline_binned]plt plot(linereg predict(line_combined)label='linear regression combined'for bin in binsplt plot([binbin][- ]':' =' ' representing data and engineering features