Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// Run Inspector Console in chrome and copy and paste the following code in the /stats/stories view | |
function download(filename, text) { | |
var pom = document.createElement('a'); | |
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
pom.setAttribute('download', filename); | |
if (document.createEvent) { | |
var event = document.createEvent('MouseEvents'); | |
event.initEvent('click', true, true); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
from wand.image import Image | |
from wand.display import display | |
%matplotlib notebook |
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
# 1000 simulations of die roll | |
n = 1000 | |
# In each simulation, there is one trial more than the previous simulation | |
avg = [] | |
for i in range(1,n): | |
a = np.random.randint(1,7,10) | |
avg.append(np.average(a)) | |
# sample 10 expected value of die rolls |
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
# Function that will plot the histogram, where current is the latest figure | |
def clt(current): | |
# if animation is at the last frame, stop it | |
plt.cla() | |
if current == 1000: | |
a.event_source.stop() | |
plt.hist(avg[0:current]) | |
plt.gca().set_title('Expected value of die rolls') |
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
# Function that will plot the histogram, where current is the latest figure | |
def clt(current): | |
# if animation is at the last frame, stop it | |
plt.cla() | |
if current == 1000: | |
a.event_source.stop() | |
plt.hist(avg[0:current]) | |
plt.gca().set_title('Expected value of die rolls') |
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
a.save('C:/Users/rohan/Documents/clt2.gif', writer='imagemagick', fps=10) |