Skip to content

Instantly share code, notes, and snippets.

@holmesal
Created January 22, 2019 14:51
Show Gist options
  • Save holmesal/aff2cb7cb4061d3b49ede21e87a15a69 to your computer and use it in GitHub Desktop.
Save holmesal/aff2cb7cb4061d3b49ede21e87a15a69 to your computer and use it in GitHub Desktop.
num_datapoints = 1000
x = np.random.rand(num_datapoints)
# our model will guess m and b:
m = 7;
b = 13;
f = 2;
# high school flashbacks
y = m * x + b;
# randomly shift some datapoints up or down, to make it a little more interesting
y = y + np.random.normal(size=num_datapoints) * 0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment