week 45
This commit is contained in:
@@ -55,6 +55,15 @@ The example here shows how we can implement the coin tossing case, clealry demos
|
||||
!split
|
||||
===== Simple Voting Example, head or tail =====
|
||||
!bc pycod
|
||||
# Common imports
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.colors import ListedColormap
|
||||
plt.rcParams['axes.labelsize'] = 14
|
||||
plt.rcParams['xtick.labelsize'] = 12
|
||||
plt.rcParams['ytick.labelsize'] = 12
|
||||
|
||||
heads_proba = 0.51
|
||||
coin_tosses = (np.random.rand(10000, 10) < heads_proba).astype(np.int32)
|
||||
cumulative_heads_ratio = np.cumsum(coin_tosses, axis=0) / np.arange(1, 10001).reshape(-1, 1)
|
||||
@@ -995,3 +1004,5 @@ plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user