recommenders
recommenders copied to clipboard
How to use pertained embedding as feature in the user model
Hello,
I have a signature embedding of size 256 for each user. How can I use this vector as a feature in the user model?
Any tips are appreciated.
You can use these embeddings as the initial weights for your user embedding layer. An example as
embedding_layer = layers.Embedding(
input_dim=xxx,
output_dim=xxx,
weights=[your embedding],
trainable=True,
)
Is this compatible with the examples in the tutorials that use string Lookup? Can this be c ombined with pretrained embedding extractors (like BERT) dynamically, or only if all are extracted in advance? Can we combine that with the tutorial examples/e.g. retrieval task? Thanks!
@ddofer This is a different approach vs. the string lookup in the tutorial.
- For this approach, basically you are extracted the embeddings beforehand, you can use any kind of pre-train embedding including Bert.
- For the string lookup approach, it's generating one unique embedding for each user or movie ID. It's trained dynamically with the model
- If you want to embed Bert models to the retrieval, you can leverage other libraries and import the Bert layers to your model structure, then trained it dynamically with your retrieval
Great thanks! (I've added that to my retrieval model using strong, large (384 dim) pretrained embeddings. Oddly, results are the same (despite this being a sparse problem for users and items)
This question cannot be answer until you share more details. The reason can be related to multiple factors.
- What kind of pretrained embeddings are you using?
- How sparse it is?
- How many data you have and how complex is the model?
- Are the pretrained embeddings fine-tuned dynamically with the model?
- What kind of features you already have?