17
$\begingroup$

I am reading a presentation and it recommends not using leave one out encoding, but it is okay with one hot encoding. I thought they both were the same. Can anyone describe what the differences between them are?

$\endgroup$
3

1 Answer 1

19
$\begingroup$

They are probably using "leave one out encoding" to refer to Owen Zhang's strategy.

From here

The encoded column is not a conventional dummy variable, but instead is the mean response over all rows for this categorical level, excluding the row itself. This gives you the advantage of having a one-column representation of the categorical while avoiding direct response leakage

This picture expresses the idea well. enter image description here

$\endgroup$
6
  • $\begingroup$ Your explanation is better than wacax's in the referred link, thank you $\endgroup$
    – Allan Ruin
    Aug 12, 2016 at 15:00
  • $\begingroup$ Hi @Dex Groves, so the leave_one_out encoding for the test is always .5? $\endgroup$ Mar 24, 2017 at 20:29
  • 3
    $\begingroup$ Hi! As seen from the picture, this paticular example relates to classification problem. Does anybody have an experience with LOO encoding within regression problem? The main question is how to aggregate the target variable. I am now making experiments and get huge overfitting with mean(y). $\endgroup$ Jun 19, 2017 at 12:49
  • 1
    $\begingroup$ for a clustering (unsupervised) problem, is possible to use this kind of encoding? $\endgroup$
    – enneppi
    Sep 13, 2018 at 10:26
  • $\begingroup$ @AlexeyTrofimov - try an aggregation with a lower variance. I'd start with different binning (like 1K, 2K, 2M, .. for large y int values, or some rounding to a decimal place for y float values) => mean(bin_f(y)) $\endgroup$
    – mork
    Mar 18, 2019 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.