# How to understand the definition of Greedy Target-based Statistics in the CatBoost paper

There is a method named Target statistics to deal with categorical features in the catboost paper. I still some confusion about the mathematical form. Could you some guys to expain how to compute it!

$$\hat{x}^i_k = \frac{\sum^{p-1}_{j=1}[x_{\sigma_{j},k}=x_{\sigma_p,k}]Y_{\sigma_j}+a\cdot P}{\sum^{p-1}_{j=1}[x_{\sigma_{j},k}=x_{\sigma_p,k}]+a}$$

• "Target" is the variable to be predicted. The formula you posted is a group-by average with laplace smoothing. Commented Sep 16, 2020 at 10:04
• @anymous.asker, there's one additional tweak with catboost, indicated in the formula by the sigma: you make these calculations according to a given permutation of the data, and each point's encoding only looks at the "previous" points in calculating the smoothed averages. Commented Sep 17, 2020 at 2:49
• Hi thanks for your comments. @anymous.asker. How to compute the previous p Commented Sep 21, 2020 at 8:33