0
$\begingroup$

I have a silly question - I have in model several variables with 100+ possible labels each (like Country that stores country code, Industry storing industry code, etc.) - I have to somehow convert this to a data consumed by a classifier.

I could encode these variables with OHE and have over 400 new variables, but then I have another issue - some of labels in these variables need to stay (so some of newly created variables will stay whatever their statistical importance is) and I cannot drop them, therefore I won't be able to reduce the number of variables from 400 to 50, but rather to 380 and I have a pretty small data set.

How would You guys approach it? Does it even make sense to encode it? I had a thought on that to replace these labels with some unified dict labels like country -> country risk with labels low, medium, high, but that one is not simple as well, but for "political" reasons this will not go through.

$\endgroup$
2
  • $\begingroup$ Please explain OHE! $\endgroup$ Jun 29 at 12:02
  • $\begingroup$ One Hot Encoder to encode categorical variables $\endgroup$
    – funkurlif3
    Jun 29 at 22:21

2 Answers 2

0
$\begingroup$

Leave one out variety of mean target encoding comes to mind (with high cardinality, target leakage is a serious concern, so other varieties might be unsuitable). There's a nice flowchart for encoding method selection at https://innovation.alteryx.com/encode-smarter/

$\endgroup$
0
$\begingroup$

I suggest you look up entity embedding,or general approaches other than one-hot encoding, like this. If you are willing to further go out of your way, I suggest you look up Spectral encoding.

$\endgroup$

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.