Skip to content

Instantly share code, notes, and snippets.

View murphyk's full-sized avatar

Kevin P Murphy murphyk

View GitHub Profile
image of an integral
Here is the chain graph version of the "Asia" network from Cowell et al 2005 p110
# "Probabilistic Networks and Expert Systems"
# https://link.springer.com/book/10.1007/b97670
@murphyk
murphyk / bayes_tails.R
Last active September 12, 2023 22:13
illustrate tail sensitivity of Bayes (from McElreath)
post_prior <- function(m_pr, m_lik, sd_pr, sd_lik, df_pr, df_lik,
xlim = c(-5, 15), n = 1001, ttl = "",...) {
xvec <- seq(xlim[1], xlim[2], length.out = n)
tfun <- function(x,m,s,df, ...) dt((x-m)/s, df)
prvec <- tfun(xvec, m_pr, sd_pr, df_pr)
likvec <- tfun(xvec, m_lik, sd_lik, df_lik)
postvec <- prvec*likvec/(sum(prvec*likvec)*diff(xvec[1:2]))
matplot(xvec, cbind(prvec, likvec, postvec),
type = "l",
@murphyk
murphyk / gist:da452f046b1d52ab4f04861725ff0625
Created May 28, 2023 18:59
free squat rack, weight bench and barbells
See phots below.
@murphyk
murphyk / shtem-2022
Created March 25, 2022 16:19
shtem payment issue
"Payment type is a required field" yet there is no way to specify it.
The first quote on https://jerrykaplan.com/, "AI isn't magic", shows up with some hidden spam links related to the chosen font.
@murphyk
murphyk / gist:6690410a967c9096b606ee550ffc6f40
Created November 3, 2021 18:44
screenshot of github projects page from my GSOC project this summer
will add file
screenshot of file editing
@murphyk
murphyk / gist:30b7ae562e392d437d3b089d926c7735
Created May 25, 2021 04:08
uncertainty baselines table
add a (14x7) table of methods * tasks, where each cell lists the metrics ("at least 5") available for that combinaiton.
@murphyk
murphyk / gist:c1871bfa8c40dc1a93258e52afa2c5d1
Last active May 21, 2021 20:43
JL training pseudocode
model = jaxLightningModule()
def fit(model):
opt = model.configure_optimizers()
opt_state = opt.init(model.params)
for iter
for batch
losses = model.step(batch)
grads = jax.grad(losses, model.params)
grad = model.reduce_gradients(grads)
param_update, opt_state = opt.update(grad, opt_state, model.params)