How to encode a class with 24,000 categories? I'm currently working on a logistic regression model for genomics. One of the input fields I want to include as a covariate is genes. There are around 24,000 known genes. There are many features with this level of variability in computational biology and hundreds of thousands of samples are needed.


If I LabelEncoder() those 24K genes
and then OneHotEncoder() them ...


Is 24,000 columns going to make my keras training times unreasonable for a 2.2 GHz quad-core i7 CPU? 

If so, is there a different approach to encoding that I can take with this?

Should I somehow try to dedicate a layer of my model to this feature?

Does this mean I need 24K input nodes?
Yes, using one-hot encoding on 24k features requires 24k input nodes. However this should not be a problem for Keras (or any other deep learning library). Natural language processing often uses one-hot encoding on words with a vocabulary size in the same ballpark.

If you are using a "deep" model, one of your hidden layers should take care of reducing the dimensionality of your data. A separate pre-processing step is usually not needed.

The training time should not be unreasonable.