nmt icon indicating copy to clipboard operation
nmt copied to clipboard

How to choose the least likely word as the output?

Open lzt2015 opened this issue 7 years ago • 3 comments

Generally, we choose the most likely word, the id associated with the maximum logit value, as the emitted word (this is the "greedy" behavior). But in some cases, I want to choose the least likely word as the output, how should I modify the code?

lzt2015 avatar Dec 22 '17 07:12 lzt2015

@lzt2015 I think you can implement a Helper class using the GreedyEmbeddingHelper as a reference. Just replace argmax with argmin should be sufficient.

oahziur avatar Mar 06 '18 01:03 oahziur

@oahziur thank you for your attention and reply!

lzt2015 avatar Mar 06 '18 01:03 lzt2015

@lzt2015 Hi, I have the similar question with you. I want to choose the second likely word. How do you deal with that? Thanks!

ryan-minyu avatar Apr 24 '19 05:04 ryan-minyu