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

Does corex have a predict function? #54

Open
RMZ3 opened this issue May 31, 2022 · 3 comments
Open

Does corex have a predict function? #54

RMZ3 opened this issue May 31, 2022 · 3 comments

Comments

@RMZ3
Copy link

RMZ3 commented May 31, 2022

Hello,

I have trained a CorEx model on a set of documents, but I now have new documents I want to infer topics for using the prior model. Is there a way to do this using CorEx?

@gregversteeg
Copy link
Owner

Yes, there is a predict function. You have to use the python API, though, I don't think there's a way to do it from the command line interface.

@RMZ3
Copy link
Author

RMZ3 commented May 31, 2022

Thank you. Is there any example code on how to use the predict function?

@GiarteDataTeam
Copy link

You can find some samples here

This also may help:

    doc_word = vector.transform(doc)
    words = list(np.asarray(vector.get_feature_names()))
    # final step of preprocessing where we remove all integers from our set of words.
    not_digit_inds = [ind for ind, word in enumerate(words) if not word.isdigit()]
    doc_word = doc_word[:, not_digit_inds]
    topics = corex_model.predict(doc_word)

where vector is defined during training and developing the model

vector = CountVectorizer(stop_words='english',  max_features=max_words, lowercase=True, ngram_range=ngram,
                                 binary=True)

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

3 participants