Skip to content

Instantly share code, notes, and snippets.

@orico
Created April 18, 2018 06:40
Show Gist options
  • Save orico/09d70c49ea2025048cdfb4c6bb3adcc5 to your computer and use it in GitHub Desktop.
Save orico/09d70c49ea2025048cdfb4c6bb3adcc5 to your computer and use it in GitHub Desktop.
data set functions
trainset_size = 60000 # ie., testset_size = 10000
def download():
 mnist = fetch_mldata(‘MNIST original’)
 X = mnist.data.astype(‘float64’)
 y = mnist.target
 print (‘MNIST:’, X.shape, y.shape)
 return (X, y)
def split(train_size):
 X_train_full = X[:train_size]
 y_train_full = y[:train_size]
 X_test = X[train_size:]
 y_test = y[train_size:]
 return (X_train_full, y_train_full, X_test, y_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment