Skip to content

Instantly share code, notes, and snippets.

@rmcelreath
rmcelreath / discrete_missingness.R
Created March 8, 2017 10:39
Discrete missing values in Stan
# "impute" missing binary predictor
# really just marginalizes over missingness
# imputed values produced in generated quantities
N <- 1000 # number of cases
N_miss <- 100 # number missing values
x_baserate <- 0.25 # prob x==1 in total sample
a <- 0 # intercept in y ~ N( a+b*x , 1 )
b <- 1 # slope in y ~ N( a+b*x , 1 )
@aparrish
aparrish / spacy_intro.ipynb
Last active March 14, 2025 21:43
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active December 18, 2025 05:55
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AustinRochford
AustinRochford / pymc3_bsplines.ipynb
Last active September 15, 2022 21:08
PyMC3 BSplines
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / csv-intro.ipynb
Last active July 18, 2023 20:00
Quick intro to CSVs. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@grimzy
grimzy / git-pull-all
Created September 15, 2017 02:15
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AustinRochford
AustinRochford / bayes_param_survival_pymc3.ipynb
Last active November 1, 2021 10:46
Bayesian Parametric Survival Analysis with PyMC3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eveskew
eveskew / discrete_missingness_multiple_cats.R
Created December 4, 2018 20:12
Discrete missing values in Stan when the number of categories > 2
# Categorical missing data in Stan
# Demonstrated with three categories
# Code and ideas adapted from @rmcelreath
# https://gist.github.com/rmcelreath/9406643583a8c99304e459e644762f82
# Code and ideas discussed with @dmontecino
# https://gist.github.com/dmontecino/b804853e4b36a57990a7108a35201cf5
@ericyd
ericyd / main.rs
Created March 24, 2020 04:20
Flow field in rust
// Cargo.toml
// ===============
// [package]
// name = "flow-field-1"
// version = "0.1.0"
// authors = ["ericyd <eric@ericyd.com>"]
//
// [dependencies]
// nannou = "0.13"
//