# Random Forests and data transformations

I've started reading about Random Forests and one of the attributes that appeals to me is that they are good at dealing with independent variables that interact with one another. Does Random Forest also "automatically" transform variables into, for example, the square of the variable? Is there a good reason to square or perform other transformations of a variable (of course dependent on the situation)? For example if I have y = x1 + x2 + x3 is there anything to be gained by running the model y = x1 + x1^2 + x2 + x2^2 + x3 + x3^2?

• A little more care in this analysis would be welcome, because squaring is not a one-to-one transformation. Thus a comparison of the square to a threshold is not quite the same thing as a comparison of the original variable to a threshold. This issue can be fixed up, provided the transformation is sufficiently nice, but what about the case of multivariate transformations of variables, such as $x_1x_2$? That's no mere "rescaling."
• I don't agree with this answer. Decision trees are built based on groups variances and if your transformation is not linear, then, in the other scale, the "most heterogeneous" grouping can change. As an example, a feature is uniformly distributed on (0,0.1) for a group and on (0.95,1.05) for the other, now take the non-linear transformation x^200 and there is a high chance those guys between 0.95 and 1.00 will be classified with the first group . Sep 8, 2018 at 21:58
• @Freguglia, that's not a problem here, because the "groups variances" refers to the dependent variable, not the features. All a decision tree cares about is the relative ordering of features, so (assuming $x$ is positive), $x^{200}$ carries the same information as $x$ for a tree model. Jan 10, 2021 at 19:22