Skip to content

Instantly share code, notes, and snippets.

View twiecki's full-sized avatar

Thomas Wiecki twiecki

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class ModelBuilder:
@classmethod
def load_default_config(cls):
# return dict of parameters
...
def __init__(self, data: pd.DataFrame, trait: str, config: Dict):
"""
Initialize the model builder.
@twiecki
twiecki / PyMC3 vs PyMC 4.0.ipynb
Last active January 6, 2022 16:01
PyMC3 vs PyMC 4.0.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twiecki
twiecki / PyMC3 vs PyMC 4.0.ipynb
Created December 24, 2021 13:06
PyMC3 vs PyMC 4.0.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twiecki
twiecki / Section4_1-Bayesian_Workflow.ipynb
Created December 2, 2021 16:09
Bayesian_Workflow.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twiecki
twiecki / probabilistic+pca.ipynb
Created November 23, 2021 13:19
probabilistic+pca.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def z_link_func(x, data=mydata):
stim = (np.asarray(dmatrix('0 + C(s, [[0], [1]])',
{'s': data.stimulus.loc[x.index]}))
)
# Apply z = (1 - x) to flip them along 0.5
z_flip = stim - x
# The above inverts those values we do not want to flip,
# so invert them back
z_flip[stim == 0] *= -1
return z_flip
@twiecki
twiecki / LoveLaneAnalysis-Copy1.ipynb
Last active April 18, 2021 19:25
LoveLaneAnalysis.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twiecki
twiecki / optimize_normalizing_constant.ipynb
Last active January 1, 2021 11:00
Skeleton to write graph optimizer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twiecki
twiecki / stochastic_volatility_jax.ipynb
Last active April 13, 2021 20:27
stochastic_volatility.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.