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 predict #1

Open
alejandrods opened this issue Apr 11, 2018 · 3 comments
Open

How predict #1

alejandrods opened this issue Apr 11, 2018 · 3 comments

Comments

@alejandrods
Copy link

Hi, I want to thank you the code because I'm studying NLP and now I'm working on word sense disambiguation. I have learn a lot of things about your code but I have a problem.

How predict with the model?

For instance I did:

prediction = model.predict([X, Y])

where X is a context with this form:

x_pred = array([[19837, 13, 15741, 1470, 796, 3, 21, 704, 13, 407, 9067, 19838, 25, 38, 11403, 21, 1, 9068, 174, 1, 82, 546, 2, 411, 11404, 141, 3569, 3, 608, 27715, 4, 2425, 47, 5, 10115, 2, 27716, 2544, 608, 7628, 2, 6203, 69, 27717, 3, 27718, 3, 2608, 27719, 2888, 25, 1511, 8288, 44, 205, 33, 1185, 2, 2811, 5, 2426, 2032, 10, 1, 143, 1720, 102, 44, 205, 151, 6, 43, 44, 113, 5, 6626, 21, 5, 10116, 608, 67, 233, 7, 246, 3, 705, 67, 21, 1, 169, 10116, 4077, 2235, 11404, 55, 20, 10117, 15, 17, 27720]])

and y_pred is the target:

y_pred = array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 55, 1721, 4, 25, 1, 3266, 201, 245, 11404]])

How can I show the word that the model predicts?

Thank you so much and I want to congratulate you for this work.:)

@Jeff09
Copy link
Owner

Jeff09 commented Apr 12, 2018

Hi, after you get y_pred, you need to mapping index to words in vocabulary, then you will have words that the model predicts.

@alejandrods
Copy link
Author

But the model what predicts? : the target_sense ('art%1:06:00::',...) or target_word ('art', 'authority',...). So in the model.predict I have to insert the context (x_pred) and the target (y_pred), right¿? And then the result is like a matrix, how can I get the result word??

@zobaed11
Copy link

Dear jeff09,
Let's assume,
test_sentence="I went to bank to deposit money"
target_word='bank'

now, please give me an insight how can I load your model and predict the sense definition for the test sentence?

thanks

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