Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize user/ item factors w/ pretrained embeddings #341

Closed
phiweger opened this issue Mar 24, 2020 · 2 comments
Closed

Initialize user/ item factors w/ pretrained embeddings #341

phiweger opened this issue Mar 24, 2020 · 2 comments

Comments

@phiweger
Copy link

Is this possible, ie can I just

model = ...
model.user_factors = pretrained_user_factors
model.item_factors = pretrained_item_factors

?

My aim would be to add existing word2vec embeddings to the model.

Thanks a lot,
Kind regards,

Adrian

@medoidai
Copy link

medoidai commented Apr 1, 2020

Hi @phiweger,

Of course!

For example in AlternatingLeastSquares you can set the factors manually.

When model.fit() is called the user_factors and item_factors will not be initialized randomly.

Here the code with the logic: https://github.com/benfred/implicit/blob/master/implicit/als.py#L137

With all respect,

Efstathios

@benfred
Copy link
Owner

benfred commented Apr 4, 2020

+1 to what @medoidai said: setting the factors before calling fit will use those instead of initializing randomly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants