Comments (2)
Hi
Yes, you are correct, argmax+accuracy is a very bad metric. Fortunately, it is not used anywhere during training other than for display, to give you an indication the something good is happening because some metric is going up. A better metric to use here would be "perplexity".
During inference, "sampling from probabilities" is a critical step. If you just use argmax (top probability) you get a sequence of the most probable words in english. Something like "the a for the is the...". That is not what you want. Sampling from probabilities indeed introduces randomness, which opens up the vocabulary of words and generates much more english-sounding sentences.
An even better approach would be to use an algorithm like "beam search" to generate the most probable sequence of n characters instead of just the most probable next character. For example, after "for" the most probable next char is " " (space) because "for" is such a frequent word. However, based on prior context, the most probable sequence could be "form" or "fortran" or indeed "for_". Beam search takes multiple paths through the sequence of probabilities and selects the most probable sequences. In a way, sampling from probabilities implements a weak form of beam search, one that will consider the most probable sequences by chance: there is a chance it picks "form" rather than "for " even though the most probable char after "for" is " " (space). If " " space had 50% probability and "m" was at 35%, sampling from probabilities can still take the "m".
from tensorflow-rnn-shakespeare.
Thanks for the prompt answer - very helpful!
from tensorflow-rnn-shakespeare.
Related Issues (20)
- Error on Running HOT 2
- What the part 2 is doing? AI to write like Shakespeare? HOT 1
- Example on how to freeze the model HOT 2
- how to add support for other languages? HOT 1
- Tensorboard HOT 2
- How long does it take to run rnn_play.py HOT 1
- UTF-8 and richer character sets? HOT 2
- Add a way to restore previously trained checkpoints for more training
- export to a SavedModel HOT 1
- ask about text generation phase HOT 1
- 'charmap' codec can't encode character HOT 2
- Incorrect use of MultiRNNCell HOT 1
- refactor to use SavedModel: tf.saved_model.simple_save
- checkpoints are very large
- move this code into a notebook HOT 1
- Continue training checkpoint HOT 1
- Get a unicode error. HOT 1
- text level HOT 1
- Is it possible to generate from seed text? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow-rnn-shakespeare.