Skip to content

Instantly share code, notes, and snippets.

@audhiaprilliant
Created April 25, 2022 15:33
Show Gist options
  • Select an option

  • Save audhiaprilliant/2748c9638f0c6c7d27916024cbe50756 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/2748c9638f0c6c7d27916024cbe50756 to your computer and use it in GitHub Desktop.
Simulation of Monty Hall Problem
# Probability of winning the game (stick in the door)
plotnine.options.figure_size = (10, 4.8)
(
ggplot(
data = df_stick
)+
geom_line(
aes(x = 'iter',
y = 'win_rate',
group = 1),
size = 1
)+
ylim(
[0, 1]
)+
scale_x_continuous(
breaks = range(0, len(df_stick) + 100, 100)
)+
labs(
title = 'Probability of winning the game (stick in 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