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

Example Code for Use #4

Open
dubbsbrandon opened this issue Oct 10, 2019 · 7 comments
Open

Example Code for Use #4

dubbsbrandon opened this issue Oct 10, 2019 · 7 comments

Comments

@dubbsbrandon
Copy link

I'm having some trouble figuring out the appropriate input and output for the model after it is created. Is there any example you can provide for the use and what I can expect to have returned? As I understand it, it should return the predicted topics, with the embedding of the document being passed, correct?

@arnicas
Copy link

arnicas commented Dec 12, 2019

Agreed, it's opaque how to use this for new documents after training, which went great. Any chance of some more insight into how to apply it?

@duongkstn
Copy link

Same question !

@kingomalek
Copy link

That would be Very helpful, I hope you can provide us with such functions

@yilunzhao
Copy link

Same question

@Shiro-LK
Copy link

Shiro-LK commented Jul 8, 2020

any update ? I have the same question

@460176980
Copy link

Same question!

@ydennisy
Copy link

ydennisy commented Oct 9, 2020

I am on the same issue - there are various places where you can get a return value which is the size of your topics, which is what you want, from looking at the eval script I have this:

NUM_TOPICS = 128

def predict(normd_bow):
    thetaAvg = torch.zeros(1, NUM_TOPICS)
    sums = normd_bow.sum(1).unsqueeze(1)
    thetaWeightedAvg = torch.zeros(1, NUM_TOPICS)
    theta, _ = model.get_theta(normd_bow)
    thetaAvg += theta.sum(0).unsqueeze(0) / normd_bow.shape[0]
    weighed_theta = sums * theta
    thetaWeightedAvg += weighed_theta.sum(0).unsqueeze(0)
    return thetaWeightedAvg

Created from this code.

EDIT: I have no idea if this is correct!

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

8 participants