Ah. I see.
So some questions and thoughts:


1 hot encoding 40,000+ post codes is maybe less than ideal, as you would have 40,000 inputs each time so…


What is it about the post code data that is actually useful to potentially solving the problem you are trying to solve? For example, the first 2 digits of the post code are most useful for US post code at least as they will basically determine the city/town. And maybe if you take the first 3 digits, that may be enough to group similar located zips within that town which may be good enough for your needs? Thus you would then have a max of 1000 values in a 1 hot encoding of those 3 digit zips (assuming all digits are used).


It would need to be encoded in some form as 94701 is not “better” or “worth more” than 94700 by simply being a higher number so some encoding would need to be used to avoid issues there.


Your current proposition above essentially converts a 5 digit post code into 5 separate 1 hot encodings each with 10 values, so 50 total. I have not seen it done like that before, is that working well for you? I was just talking to @Laurence_Moroney about this and we are curious to hear how well that works if you do manage to try that.