Skip to content

Instantly share code, notes, and snippets.

Vincent Lefoulon Vayel

Block or report user

Report or block Vayel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:d4ce2ce6753e4788c4b0306b350fef60
### Keybase proof
I hereby claim:
* I am vayel on github.
* I am vayel (https://keybase.io/vayel) on keybase.
* I have a public key ASBu4piKL-qabomWg9YNFVEaJls_4hnebIMSwdm-oaTkAAo
To claim this, I am signing this object:
View ks_test_distribution.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import kstwobign
d_min, d_max = kstwobign.ppf(0.01), kstwobign.ppf(0.99)
d_vals = np.linspace(d_min, d_max, num=100)
cdf = kstwobign.cdf(d_vals)
fig, ax = plt.subplots()
ax.plot(d_vals, cdf, '-')
View asset.py
import random
import json
Y0 = 100
noise = lambda: random.gauss(0, 0.01)
def run(steps):
y = [Y0] * steps
for t in range(1, steps):
y[t] = y[t-1] * (1 + noise())
@Vayel
Vayel / data.csv
Last active Aug 15, 2018
ks_test_data
View data.csv
0.0 0.253 0.490 0.695 0.855
0.013 0.133 0.217 0.713 1.04
0.044 0.284 0.587 0.855 0.739
0.238 0.361 0.400 0.598 0.829
-0.098 0.054 0.428 0.791 0.836
-0.042 0.310 0.474 0.633 0.799
View ks_test.py
import scipy.stats
import numpy as np
def ks_test(real_series, simulated_series):
# `real_series` and `simulated_series` are lists of series, i.e. lists of lists.
# All series have the same size but we don't need to have as many real series as
# simulated series.
real_series, simulated_series = map(np.asarray, (real_series, simulated_series))
n_steps = len(real_series[0])
View coin_model.py
import random
# A stochastic model with a single input `p` and a single output `side`
# `p` is the probability of throwing tail
# `side` is either 'head' or 'tail'
def coin_model(p, seed=None):
# The seed allows us to control randomness and ensure reproducibility
random.seed(seed)
# Mathematically, `side_output` is a discrete random variable
You can’t perform that action at this time.