Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bobbywlindsey/82059d3c11d9d33b2e0e48f2f9c66d8b to your computer and use it in GitHub Desktop.
Save bobbywlindsey/82059d3c11d9d33b2e0e48f2f9c66d8b to your computer and use it in GitHub Desktop.
Splitting features and label for the perceptron data
train_data = pd.DataFrame(data = data, index=list(range(len(data))), columns=['X_1', 'X_2', 'label'])
# Don't forget to add a vector of 1s for the bias weight
train_data['bias'] = np.repeat(1.0, train_data.shape[0])
train_label = train_data.label
train_data = train_data[[each for each in train_data.columns if each != 'label']]
train_data.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment