Skip to content

Instantly share code, notes, and snippets.

@olooney
Created May 13, 2019 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olooney/e5915bedda33ae0e78cee3b89204fd06 to your computer and use it in GitHub Desktop.
Save olooney/e5915bedda33ae0e78cee3b89204fd06 to your computer and use it in GitHub Desktop.
X = np.hstack([np.ones(shape=(23, 1)), np.random.normal(size=(23, 2))])
Theta = np.array([0.5, +0.1, -0.2]).reshape( (3, 1) )
Y = X @ Theta + np.random.normal(0, 0.1, size=(23, 1))
Theta_hat = np.linalg.inv(X.T @ X) @ X.T @ Y
Theta_hat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment