Created
April 25, 2022 15:31
-
-
Save audhiaprilliant/436843e876b94f7468f91f339ddd990b to your computer and use it in GitHub Desktop.
Simulation of Monty Hall Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Probability of winning the game (switch the door) | |
| plotnine.options.figure_size = (10, 4.8) | |
| ( | |
| ggplot( | |
| data = df_switch | |
| )+ | |
| geom_line( | |
| aes(x = 'iter', | |
| y = 'win_rate', | |
| group = 1), | |
| size = 1)+ | |
| ylim( | |
| [0, 1] | |
| )+ | |
| scale_x_continuous( | |
| breaks = range(0, len(df_switch) + 100, 100) | |
| )+ | |
| labs( | |
| title = 'Probability of winning the game (switch the door)' | |
| )+ | |
| xlab( | |
| xlab = 'Number of iteration' | |
| )+ | |
| ylab( | |
| ylab = 'Probability' | |
| )+ | |
| theme_minimal() | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment