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

How can I transform a new document using an already trained model? #3

Closed
JennieGerhardt opened this issue Apr 6, 2021 · 1 comment

Comments

@JennieGerhardt
Copy link

JennieGerhardt commented Apr 6, 2021

with open('model{}.pickle'.format(best_topic), 'rb') as f:
    best_model = pkl.load(f)

user_vec = btm.get_vectorized_docs(user_texts, vocabulary) # len(user_texts) = 400
user_td = best_model.transform(user_vec) # _**However, len(user_td) = 245081 (Length of the training corpus)**_
user_topic = pd.DataFrame()
user_topic['portrait'] = user['portrait'] # len(user_topic['portrait'])  = 400
user_topic['topic'] = list(user_td) # ERROR   245081 != 400
@maximtrp
Copy link
Owner

maximtrp commented Apr 6, 2021

Thank you for this report! This section was not thoroughly tested. The shape of the output matrix was not correct indeed. I have already released the new version that hopefully fixes it.

@maximtrp maximtrp closed this as completed Apr 6, 2021
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