Created
May 28, 2018 05:35
-
-
Save angeris/6f3ff05fa99b2b377fcf309bdc467512 to your computer and use it in GitHub Desktop.
Learns the sum of two numbers. In response to an hn comment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
X = np.array([ | |
[1, 4], | |
[20, 35], | |
[8, 15] | |
]) | |
y = np.array([3, 15, 7]) | |
opt_theta = np.linalg.lstsq(X, y) | |
print(opt_theta[0]) | |
# Prints [-1. 1.] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment