Skip to content

Instantly share code, notes, and snippets.

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

  • Save audhiaprilliant/436843e876b94f7468f91f339ddd990b to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/436843e876b94f7468f91f339ddd990b to your computer and use it in GitHub Desktop.
Simulation of Monty Hall Problem
# 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