0

I am trying to encode ordinal data. I found a post which suggests a way to do it. Where to find a guide to encoding categorical features? This seems to make sense. For nominal data, I would do the one-hot encoding. For ordinal data, is there any encoding that does what the post suggests?

Also, if ordinal data is some string such as excellent, good, or average, how do you usually proceed? It seems many people just do the one-hot encoding.

lovemath
  • 46
  • 1
  • 3
  • 1
    First idea is to encode as numeric and add some higher order terms. That will capture any non linearities in the scale. – Cam.Davidson.Pilon Sep 26 '19 at 22:20
  • @Cam.Davidson.Pilon Thanks for the comment. When you say to encode as numeric, do I choose some numbers for the string data? or is there a structured way to do it? – lovemath Sep 27 '19 at 00:34
  • Since it's ordinal, you can assign 0, 1, 2...N to it. In Python, a simple dictionary can map between the strings and value – Cam.Davidson.Pilon Sep 27 '19 at 01:03
  • @Cam.Davidson.Pilon Thank you! After converting this way, are there other preferred encodings for ordinal data that is not the one-hot encoding? The one-hot encoding does not seem to reflect the order. About the higher-order terms, if I include the higher-order terms, wouldn't I be considering that as numerical data? – lovemath Sep 27 '19 at 03:42

0 Answers0