Skip to content

Instantly share code, notes, and snippets.

View DavisVaughan's full-sized avatar

Davis Vaughan DavisVaughan

View GitHub Profile
alexpghayes / broadcast.Rmd
Created August 10, 2017 04:44
attempt to explain why broadcasting is bae
A starter example is centering a matrix
import numpy as np
X = np.random.normal(size=(3, 3)) # random 3 by 3 matrix
mu = X.mean(axis = 0) # array (vector) of column means
print("Original matrix")