Exercise 2 - sample

You have a note

Now that you have 𝑦⟨𝑡+1⟩, you want to select the next letter in the dinosaur name. If you select the most probable, the model will always generate the same result given a starting letter. To make the results more interesting, use np.random.choice to select a next letter that is likely, but not always the same.

So, I would like to know, what means how is “to select a next letter that is likely” because as I understand, that we only randomly fetched letters. Did I understand not correct?

In this context I think your understanding is right!

so, as I understand we should fetch not only any random choices, but that have big propability, isn’t it?

We have two dinosaurs’ names:


So, what is common in them? The first three letters, “Abr”. If we tend to choose the most probable letters, it will never generate the new name because every time, it will choose the most probable letter which in the case is i or o, right? But if we randomize and choose the likely letter, it will choose different letters after the first three letters.


and if example does’t exist with starting words abr?

1 Like

Our model generates similar words (not exactly the same) on which it is trained.

oh, I only understood now. So, can it generate unreal names of dinos, right?

Yes. This is what you will do at the end of this assignment.

1 Like

but I still not understand honestly. If we choose random char, why do we need Neural Network at all?

We don’t choose random words blindly. As mentioned, " use np.random.choice to select a next letter that is likely".

hmm, so how does it define it as likely? I see, that there is rude random yet

It is trained on the training set, so it learns the patterns from existing dinosaur names. Then the trained model gives a selection of letters based on the training set that it thinks might be likely as the next letter, given the ones that it has seen in the name up to this point. You could just always pick the one considered the highest probability as the next letter, but they introduce np.random.choice to make the results a little “spicier” and not as predictable. That was the point of the comment that you started this thread with. If you don’t do that, then whatever the first letter is would determine the answer.

1 Like