Build a character level language model to generate new dinosaur names
A language model is the one where given an input sentence, the model outputs a probability of how correct that sentence is. This is extensively used in speech recognition, sentence generation and machine translation systems where it outputs the sentences that are likely.
Steps to build a language model:
At t time step, RNN is estimating P(y
To get probability for a random sequence, break down the joint probability distribution P(y1, y2, y3, …) as a product of conditionals, P(y1) P(y2 | y1) P(y3 | y1, y2).
NOTE: In vanilla language model as described above, word is a basic building block.
In character level language model, the basic unit/ lowest level is a character, which makes building a dictionary very easy (finite number of characters)
Once the model is trained, we can sample new text(characters). The process of generation is explained below:
Steps:
Some of the names generated:
If you observe carefully, our model has learned to capture saurus
, don
,aura
, tor
at the end of every dinosaur name
TODO: Use LSTM in-place of RNNs with help of Keras
Place the training data (dinosaur names) in-place of dinos.txt
.
Run main.py
, which follows 3 steps:
To generate the names out-of-the-box, runpython main.py