Reduce Categorical Values I'm working on one use case where I have to explore source code repo files. Different files will be a categorical values for me. But with such large number of files, One Hot Encoding comes out to be very large.
Also, all files are divided among unique modules, such that each files belongs to a specific module.
So if I consider unique files associated with specific modules comes out to be small in number and One Hot Encoding matrix is also not large.

So if I define different modules as a  categorical features, I'm not sure how to map the associated unique files.
How to derive new feature with such combination of two categorical features?
Any other better way to handle such use case?
Recently practitioners are representing categorical variables as embeddings for  ML models. I can see a solution to your problem there.
As your problem is having a two-level hierarchy you can consider two embeddings, one set of embeddings for modules, and another set for files. For every document, you can take their combination and pass it as input to the model. In this way, both the module and file-level information will be captured.
References:
https://towardsdatascience.com/deep-embeddings-for-categorical-variables-cat2vec-b05c8ab63ac0