Skip to content

Instantly share code, notes, and snippets.

View audhiaprilliant's full-sized avatar
🎯
Focusing

Audhi Aprilliant audhiaprilliant

🎯
Focusing
View GitHub Profile
@audhiaprilliant
audhiaprilliant / machine_learning_deployment_1.py
Last active May 16, 2022 11:36
End to end machine learning model deployment using flask
# Data frame manipulation
import pandas as pd
# Matrices operation
import numpy as np
# Data visualization with plotnine
from plotnine import *
import plotnine
@audhiaprilliant
audhiaprilliant / monty_hall_problem.ipynb
Created April 25, 2022 15:42
Simulation of Monty Hall Problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@audhiaprilliant
audhiaprilliant / monty_hall_problem_8.py
Created April 25, 2022 15:35
Simulation of Monty Hall Problem
plotnine.options.figure_size = (10, 4.8)
(
ggplot(
data = df_general
)+
geom_line(
aes(x = 'iter',
y = 'value',
group = 'status',
color = 'status'),
@audhiaprilliant
audhiaprilliant / monty_hall_problem_7.py
Created April 25, 2022 15:34
Simulation of Monty Hall Problem
# Perform a empirical simulation
data_general = monty_hall(
num_iter = 1000,
switch = True
)
# Create a data rame
df_general = pd.DataFrame(
data = data_general
)
@audhiaprilliant
audhiaprilliant / monty_hall_problem_6.py
Created April 25, 2022 15:33
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),
@audhiaprilliant
audhiaprilliant / monty_hall_problem_5.py
Created April 25, 2022 15:32
Simulation of Monty Hall Problem
# Perform a empirical simulation
data_stick = monty_hall(
num_iter = 1000,
switch = False
)
# Create a data rame
df_stick = pd.DataFrame(
data = data_stick
)
@audhiaprilliant
audhiaprilliant / monty_hall_problem_4.py
Created April 25, 2022 15:31
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),
@audhiaprilliant
audhiaprilliant / monty_hall_problem_3.py
Created April 25, 2022 15:31
Simulation of Monty Hall Problem
# Perform a empirical simulation
data_switch = monty_hall(
num_iter = 1000,
switch = True
)
# Create a data rame
df_switch = pd.DataFrame(
data = data_switch
)
@audhiaprilliant
audhiaprilliant / monty_hall_problem_2.py
Created April 25, 2022 15:29
Simulation of Monty Hall Problem
# Monty Hall Problem
def monty_hall(
num_iter: int,
switch: bool
):
# Data object
obj = []
for iteration in range(num_iter):
# Possibilities in doors
@audhiaprilliant
audhiaprilliant / monty_hall_problem_1.py
Created April 25, 2022 15:29
Simulation of Monty Hall Problem
# Data frame manipulation
import pandas as pd
# Mathematical operations
import numpy as np
# Data visualization
import plotnine
from plotnine import *