Created
July 18, 2019 16:00
-
-
Save michelkana/f13e251616a08137e25973406d91278d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import matplotlib.pyplot as plt | |
# generate binary data | |
x = np.sort(np.random.uniform(-2.0, 3.0, 100)) | |
y = 1.0 / (1.0 + np.exp(-5*x)) | |
y = y + np.random.normal(0, 0.5, 100) | |
y[y < 0.5] = 0 | |
y[y >= 0.5] = 1 | |
plt.scatter(x,y) | |
plt.xlabel('year') | |
plt.ylabel('harvest good/bad') | |
plt.title('original data') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment