1
$\begingroup$

I am trying to build a regression model, for which I have a nominal variable with very high cardinality. I am trying to get the categorical embedding of the column.

Input:

df["nominal_column"]

Output:

the embeddings of the column.

I want to use the op of the embedding column alone since I would require that as a input to my traditional regression model. Is there a way to extract that output alone.

P.S I am not asking for code, any suggestion on the approach would be great.

$\endgroup$
1
$\begingroup$

As far as I understand, usually embeddings are initialized with random values. If there are pretrained embeddings, they can be loaded, but of course there are no such things for categorical variables.

So if you simply create an embedding of a categorical feature, you'll get a vector representation, but it will have random variables. So at first you'll need to train the neural net. After it is trained, you could take the output of the embedding layer and use it in regression model.

But are you sure that you need the embedding? You could do mean encoding or frequency encoding.

| improve this answer | |
$\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.