October 2019
Intermediate to advanced
340 pages
8h 39m
English
You may want to know whether the optimal policy really works. Let's act like smart gamblers and play 10,000 episodes of the game. We are going to compare the optimal policy with two other strategies: conservative (betting one dollar each round) and random (betting a random amount):
We define the optimal strategy first:
>>> def optimal_strategy(capital):... return optimal_policy[capital].item()
Then we define the conservative strategy:
>>> def conservative_strategy(capital):... return 1
Finally, we define the random strategy:
>>> def random_strategy(capital):... return torch.randint(1, capital + 1, (1,)).item()
Read now
Unlock full access