Skip to content

Commit

Permalink
Some corrections and create_dateset.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
shwars committed Mar 17, 2020
1 parent db57d38 commit 499eb95
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 1,321 deletions.
70 changes: 70 additions & 0 deletions create_dataset.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.datasets import fetch_openml\n",
"from sklearn.model_selection import train_test_split\n",
"import os\n",
"import pickle\n",
"import numpy as np\n",
"\n",
"print('fetching MNIST data...')\n",
"mnist = fetch_openml('mnist_784')\n",
"mnist['target'] = np.array([int(x) for x in mnist['target']])\n",
"\n",
"# use a random subset of n records to reduce training time.\n",
"n = 20000\n",
"shuffle_index = np.random.permutation(70000)[:n]\n",
"X, y = mnist['data'][shuffle_index], mnist['target'][shuffle_index]\n",
"\n",
"os.makedirs('dataset',exist_ok=True)\n",
"with open('dataset/mnist.pkl','wb') as f:\n",
" pickle.dump((X,y),f)\n",
"\n",
"print('Done')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"inputHidden": false,
"outputHidden": false
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernel_info": {
"name": "python3"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
},
"nteract": {
"version": "nteract-front-end@1.0.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 499eb95

Please sign in to comment.