Embedding layer has one more row than expected

I am trying to use the tabular learner to predict continuous values. A number of my columns are categorical, so I’m expecting them to convert to embedding layers.

One of my categorical variables is month. I was expecting to see Embedding (12, 7) in the model, but I’m actually seeing Embedding (13, 7). And a number of other categorical variables seem to have one more row than I’m expecting.

Does anyone know why there is one more row in the embedding layer?

It may be possible that your data has None-values (missing month data for some rows), as I remember. Framework treats None-values as separate value, and you get additional row in Embedding matrix.

Thanks for the response, @Pak! And that is a good thought. But I went through and double checked and I’m seeing 12 unique values in my month column. Not sure where the 13 is coming from…

Turns out you were actually right, @Pak! But it wasn’t because of my data. Instead, it looks like the Fastai library is adding a class #na#. Here’s the link if you are interested:

Thanks again for your help!

2 Likes