Hello and welcome to this art tutorial.
So in the previous tutorial, we got the exciting result of the total
reward being 2178
and therefore almost doubling the total reward
we get with the random selection algorithm, which was around 1002 hundred.
So that was the first exciting result.
And we also got another exciting result, which was, you know, the best add
to show to the user given by this add selected vector.
By looking at the last round here containing only five, that showed us
that the ad with the highest conversion rate is the version number five of the ad.
So two exciting results.
And now to finish the section even better, we will have a look
at the histogram to have a quick look at the overall strategy.
You know, to see the number of times each ad was selected
and how the selections of ad number five dominate the selections of the other ads.
So that's going to be very quick and easy because we simply need to use hist
which is right here enter.
And now as input we simply need to get the variable
that contains the values we want to plot on this histogram.
And that's of course the ads selected
vector.
Because you know this vector tells us which ad was selected at each round.
And so this histogram method here will look at the number of times
each ad was selected in this ad selected vector.
And that will plot the histogram.
So basically we're done.
And now just to make it better we can add a color.
So we type call equals blue in quotes.
If of course we want the blue color.
And then add a title by adding this main equals.
And then in quotes we add a title.
And so let's say histogram
of well add selections.
Here we go.
And we can also add a label to the x axis.
So same we use in quotes we add here add.
All right.
Because you know
basically what we'll have on the x axis are going to be the labels of the ads.
So that's why I'm adding here ads.
And of course let's add y label quotes.
And let's say of times
each ad was selected.
Great. And basically we're done.
So now let's have a look.
We will select this code section here
and press Command and Control Plus enter to execute.
And here is the histogram.
And well we can clearly see that the ad number
five is the ad that was most selected by the users.
That is the ad that has the highest conversion rate.
And therefore no doubt that's the ad we need to show to our users
for the marketing campaigns of this cheap, brand new luxury SUV.
So no doubt the fifth ad.
Wonderful.
We completed our job as a machine learning scientist and so congratulations!
We implemented a great algorithm.
So now what we'll do is implement another algorithm to see if we can do better.
And this other algorithm will be Thompson sampling algorithm.
So let's see if Thompson sampling can beat UCB.
And we'll find out in the next section.
And so then enjoy machine learning.