Skip to content

Instantly share code, notes, and snippets.

@fonnesbeck
fonnesbeck / dependent_density_regression.ipynb
Created September 30, 2024 01:04
Reproducible example for multiprocessing failure
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.
@fonnesbeck
fonnesbeck / log.txt
Created May 23, 2023 16:48
VSCode logging for remote extension installation
2023-05-23 11:18:55.462 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.vscode-selfhost-test-provider' wants API proposal 'testContinuousRun' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
2023-05-23 11:18:55.794 [error] Extension 'github.copilot' appears in product.json but enables LESS API proposals than the extension wants.
package.json (LOSES): inlineCompletionsAdditions, terminalDataWriteEvent
product.json (WINS): inlineCompletionsAdditions
2023-05-23 11:18:55.848 [info] Invoking resolveAuthority(attached-container)...
2023-05-23 11:18:55.849 [info] [LocalProcess0][resolveAuthority(attached-container,1)][0ms] obtaining proxy...
2023-05-23 11:18:55.849 [info] [LocalProcess0][resolveAuthority(attached-container,1)][0ms] invoking...
2023-05-23 11:18:56.852 [info] [LocalProcess0][resolveAuthority(attached-container,1)][1004ms] waiting...
2023-05-23 11:18:57.854 [info] [LocalProcess0][resolveAuthority(attached-co
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.
@fonnesbeck
fonnesbeck / StudentT.ipynb
Created August 12, 2019 18:21
StudentT sampling
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
more_curves = [1810, 2225, 3015]
with curve_spin_model:
pm.set_data({'spin': more_curves})
post_pred = pm.sample_posterior_predictive(trace, samples=1000)
df = pd.DataFrame(dict(y=np.array([2, 4, 2, 0, 4])))
with pm.Model() as glm:
x = np.array([0.3, 1.1, 0.6, -0.2, 3.3])
pm.glm.GLM.from_formula('y ~ x', data=df, family=pm.glm.families.Poisson())
traces = {}
for year in years:
with curve_spin_model:
year_data = curveball_data.query('year==@year')
pm.set_data({'spin': year_data.spin_rate,
'swing_miss': year_data.miss})
traces[year] = pm.sample(1000, tune=2000,
cores=2, progressbar=False)
with pm.Model() as curve_spin_model:
spin = pm.Data('spin', curveball_data['spin_rate'])
β = pm.Normal('β', shape=2)
θ = β[0] + β[1]*(spin/1000)
swing_miss = pm.Data('swing_miss', curveball_data['miss'])
miss = pm.Bernoulli('miss', pm.invlogit(θ), observed=swing_miss)