Skip to content

Instantly share code, notes, and snippets.

@lastlegion
Created October 9, 2013 13:08
Show Gist options
  • Save lastlegion/6900989 to your computer and use it in GitHub Desktop.
Save lastlegion/6900989 to your computer and use it in GitHub Desktop.
Generating synthetic data for perceptron
def generateData(X, y):
i=0
for i in range(0,N):
datapoint = [random.uniform(-1,1), random.uniform(-1,1)]
X[i] = datapoint
if(datapoint[0] + datapoint[1] > 0):
y[i] = 1
else:
y[i] = -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment