facebookresearch / fastText

Library for fast text representation and classification.
https://fasttext.cc/
MIT License
25.91k stars 4.72k forks source link

Can I compute prediction score using output/input matrix for supervised mode. #1051

Open yurkor opened 4 years ago

yurkor commented 4 years ago

I trained supervised model using hs loss. When I am trying to get predicted label by get_output_matrix()*sentence_vector I got irrelevant results compared to method predict. Is this because we have bias vector for both hidden and output layer? Is there a way to get it via python api?


np.argmax(np.matmul(model.get_output_matrix(), model.get_sentence_vector(sentence)))
vs
np.predict(sentence)
` ``
JuliaPoo commented 4 years ago

Yes you can. However, the prediction scores won't match because fasttext applies a softmax on the output, so you can do that if you want them to match.