> be me
> dukenukem.jpg
> tired of playing ITCrowd.exe
> drool while looking at HMC.jpeg
> install numpyro
> assume homogeneous coupling
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 time | |
import tqdm | |
import numpy as np | |
import tensorflow as tf | |
import numba as nb | |
#tf.config.experimental.set_visible_devices([], 'GPU') | |
tf.zeros((1,), tf.float32) | |
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 sys | |
import time | |
from autograd import numpy as np, grad | |
from autograd.misc.optimizers import adam, rmsprop, sgd | |
from scipy.optimize import minimize | |
import pylab as pl | |
# simplification of the generic 2d oscillator | |
def dfun(state, w, theta): |
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 time | |
from autograd import numpy as np, grad | |
from autograd.scipy.integrate import odeint | |
from autograd.builtins import tuple | |
from autograd.scipy.stats import norm | |
from autograd.misc.optimizers import adam | |
def vdpo(y, t0, a, k, tau=3.0): | |
x, y = np.reshape(y, (2, -1)) |
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 tvb.simulator.lab as tvb | |
from tvb.basic.neotraits.api import Final, List | |
# setup model based on paper's parameters | |
model_pars = dict( | |
A=3.25, | |
B=22.0, | |
v0=6.0, | |
a=0.1, # TVB uses ms, not s |
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 pystan | |
try: | |
model # avoid recompiling during IPython/notebook session | |
except: | |
model = pystan.StanModel('sdde.stan') | |
data = dict( | |
nt=500, | |
d=50, |
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
from autograd import grad, numpy as np | |
from autograd.scipy.stats import norm | |
from autograd.misc.optimizers import adam | |
def simple_vi(n=2000): | |
x = np.random.normal(loc=+1.5, scale=+0.3, size=10) | |
log_p = lambda z: np.mean(norm.logpdf(x[:, None], z[0], np.exp(z[1])), axis=0) | |
log_q = lambda z, l: norm.logpdf(z, l[:, None], 0.3) | |
samp_q = lambda l: np.random.normal(l[:, None], 0.3, (2, n)) | |
# https://arxiv.org/pdf/1401.0118.pdf, eq 3 |
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
from pycallgraph import PyCallGraph | |
from pycallgraph.output import GraphvizOutput | |
from pycallgraph import GlobbingFilter | |
from pycallgraph import Config | |
from tvb.simulator.models.wong_wang import ReducedWongWang | |
from tvb.simulator.lab import * | |
import numpy |
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 IPython.core.magic, subprocess | |
@IPython.core.magic.register_cell_magic | |
def ssh(line, cell): | |
proc = subprocess.Popen(['ssh'] + line.split(), | |
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |
out, _ = proc.communicate(cell.encode('ascii')) | |
print(out.decode('ascii')) |