# Is it necessary to normalize data for XGBoost?

MinMaxScaler() in scikit-learn is used for data normalization (a.k.a feature scaling). Data normalization is not necessary for decision trees. Since XGBoost is based on decision trees, is it necessary to do data normalization using MinMaxScaler() for data to be fed to XGBoost machine learning models?

## 2 Answers

Your rationale is indeed correct: decision trees do not require normalization of their inputs; and since XGBoost is essentially an ensemble algorithm comprised of decision trees, it does not require normalization for the inputs either.

For corroboration, see also the thread Is Normalization necessary? at the XGBoost Github repo, where the answer by the lead XGBoost developer is a clear:

no you do not have to normalize the features

While decision trees have a natural resistance to outliers, boosted trees are susceptible, since new trees are built off the residual. Normalization, or even just a log transform, will give you better protection from outliers.

For an XGB model that is planned to go into production, I recommend doing it. It's not like one can interpret the output anyway. I think of XGBoost as being on the black box side.

• Normalization is not about removing outliers, which will be present anyway even after normalization; and the residuals have to do with the output, not with the features, which the question is about. Apr 21 at 20:23