Frequency encoding is a widely used technique in Kaggle competitions, and many times proves to be a very reasonable way of dealing with categorical features with high cardinality. I really don't understand why it works.

Does it work in very specific cases where frequencies are correlated with the target or is it more general? What's the rationale behind it?

  • $\begingroup$ maybe this answer $\endgroup$ – Nikos M. Jul 26 at 8:26
  • $\begingroup$ @NikosM. Can you copy that answer here? $\endgroup$ – Itamar Mushkin Jul 30 at 7:14

Check this post.

In the cases where the frequency is related somewhat with the target variable, it helps the model to understand and assign the weight in direct and inverse proportion, depending on the nature of the data.

Check also this thread.

What's the rationale behind it?

High cardinality may result in dimensionality curse and actually decrease the quality of your model.

| improve this answer | |
  • 1
    $\begingroup$ The second thread talks about something different I think. I understand it is talking about target encdoing. And about the dimensionality curse, target encoding also helps solving it but frequency encoding is preferred sometimes. Why is that? $\endgroup$ – David Masip Nov 25 '19 at 16:13
  • 1
    $\begingroup$ Frequency may convey some actual domain knowledge. Stating it explicitly may help and keeps dimensionality low. All of this is a matter of debate and I wouldn't blindly follow it. $\endgroup$ – Piotr Rarus - Reinstate Monica Nov 25 '19 at 16:15

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.