Skip to content

Instantly share code, notes, and snippets.

@michelkana
Created July 18, 2019 16:00
Show Gist options
  • Save michelkana/f13e251616a08137e25973406d91278d to your computer and use it in GitHub Desktop.
Save michelkana/f13e251616a08137e25973406d91278d to your computer and use it in GitHub Desktop.
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