Skip to content

Instantly share code, notes, and snippets.

@chmodsss
Created August 16, 2018 16:40
Show Gist options
  • Save chmodsss/3cb3fe22a1b53ebb137142919b4ad9e0 to your computer and use it in GitHub Desktop.
Save chmodsss/3cb3fe22a1b53ebb137142919b4ad9e0 to your computer and use it in GitHub Desktop.
NN from scratch. data preparation
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
%matplotlib inline
dig = load_digits()
plt.gray()
plt.matshow(dig.images[25])
onehot_target = pd.get_dummies(dig.target)
x_train, x_val, y_train, y_val = train_test_split(dig.data, onehot_target, test_size=0.1, random_state=20)
# shape of x_train :(1617, 64)
# shape of y_train :(1617, 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment