The Algorithms logo
The Algorithms
Про AlgorithmsПожертвувати

Neural Network Mnist Dataset

H
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Neural_network_Mnist_Dataset.ipynb","provenance":[],"collapsed_sections":[]},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"code","metadata":{"id":"77SSSwx1yiCQ","colab_type":"code","outputId":"8d3c5c95-0a98-4a77-d7fe-abd253f193a2","executionInfo":{"status":"ok","timestamp":1572961471098,"user_tz":-330,"elapsed":2481,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":80}},"source":["import tensorflow as tf"],"execution_count":0,"outputs":[{"output_type":"display_data","data":{"text/html":["<p style=\"color: red;\">\n","The default version of TensorFlow in Colab will soon switch to TensorFlow 2.x.<br>\n","We recommend you <a href=\"https://www.tensorflow.org/guide/migrate\" target=\"_blank\">upgrade</a> now \n","or ensure your notebook will continue to use TensorFlow 1.x via the <code>%tensorflow_version 1.x</code> magic:\n","<a href=\"https://colab.research.google.com/notebooks/tensorflow_version.ipynb\" target=\"_blank\">more info</a>.</p>\n"],"text/plain":["<IPython.core.display.HTML object>"]},"metadata":{"tags":[]}}]},{"cell_type":"code","metadata":{"id":"BZFEQNv2zvTc","colab_type":"code","colab":{}},"source":["from tensorflow.examples.tutorials.mnist import input_data"],"execution_count":0,"outputs":[]},{"cell_type":"code","metadata":{"id":"SeQBBhaNz-eL","colab_type":"code","outputId":"b07f8611-c5ca-4734-ecff-257c1bfb8c3d","executionInfo":{"status":"ok","timestamp":1572961576091,"user_tz":-330,"elapsed":1501,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":534}},"source":["mnist = input_data.read_data_sets(\"MNIST_data/\" , one_hot=True)"],"execution_count":0,"outputs":[{"output_type":"stream","text":["WARNING:tensorflow:From <ipython-input-4-c6bc8264dab0>:1: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please use alternatives such as official/mnist/dataset.py from tensorflow/models.\n","WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please write your own downloading logic.\n","WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/base.py:252: _internal_retry.<locals>.wrap.<locals>.wrapped_fn (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please use urllib or similar directly.\n","Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.\n","WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please use tf.data to implement this functionality.\n","Extracting MNIST_data/train-images-idx3-ubyte.gz\n","Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.\n","WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please use tf.data to implement this functionality.\n","Extracting MNIST_data/train-labels-idx1-ubyte.gz\n","WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:110: dense_to_one_hot (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please use tf.one_hot on tensors.\n","Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.\n","Extracting MNIST_data/t10k-images-idx3-ubyte.gz\n","Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.\n","Extracting MNIST_data/t10k-labels-idx1-ubyte.gz\n","WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n","Instructions for updating:\n","Please use alternatives such as official/mnist/dataset.py from tensorflow/models.\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"RVi_Aumn0N5z","colab_type":"code","outputId":"77dd0e76-ad94-4b97-cc94-b9365143ce95","executionInfo":{"status":"ok","timestamp":1572961688834,"user_tz":-330,"elapsed":827,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"source":["type(mnist)"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["tensorflow.contrib.learn.python.learn.datasets.base.Datasets"]},"metadata":{"tags":[]},"execution_count":5}]},{"cell_type":"code","metadata":{"id":"bvRf0B-I01DL","colab_type":"code","outputId":"5cc3f2ba-53f1-45d4-f268-619d80e3cec8","executionInfo":{"status":"ok","timestamp":1572961746349,"user_tz":-330,"elapsed":848,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":137}},"source":["mnist.train.images"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["array([[0., 0., 0., ..., 0., 0., 0.],\n","       [0., 0., 0., ..., 0., 0., 0.],\n","       [0., 0., 0., ..., 0., 0., 0.],\n","       ...,\n","       [0., 0., 0., ..., 0., 0., 0.],\n","       [0., 0., 0., ..., 0., 0., 0.],\n","       [0., 0., 0., ..., 0., 0., 0.]], dtype=float32)"]},"metadata":{"tags":[]},"execution_count":8}]},{"cell_type":"code","metadata":{"id":"hWEh9KXe0pmK","colab_type":"code","outputId":"bc11c7e5-cddd-439a-ea1a-6d5bdf7a06b1","executionInfo":{"status":"ok","timestamp":1572961729558,"user_tz":-330,"elapsed":872,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"source":["mnist.train.num_examples"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["55000"]},"metadata":{"tags":[]},"execution_count":7}]},{"cell_type":"code","metadata":{"id":"nMDBHJlf0ur6","colab_type":"code","outputId":"ad04c45a-b868-43f6-e51c-fd95863a3a26","executionInfo":{"status":"ok","timestamp":1572961820396,"user_tz":-330,"elapsed":1111,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"source":["mnist.test.num_examples"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["10000"]},"metadata":{"tags":[]},"execution_count":9}]},{"cell_type":"code","metadata":{"id":"idFLPhYd1Jg6","colab_type":"code","colab":{}},"source":["#visualize the data\n","\n","import matplotlib.pyplot as plt\n","\n","%matplotlib inline\n"],"execution_count":0,"outputs":[]},{"cell_type":"code","metadata":{"id":"ftbQKAig1SjE","colab_type":"code","outputId":"32782700-cb36-4ac4-9f10-3f285085fb0d","executionInfo":{"status":"ok","timestamp":1572961939986,"user_tz":-330,"elapsed":654,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":34}},"source":["mnist.train.images[1].shape"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["(784,)"]},"metadata":{"tags":[]},"execution_count":13}]},{"cell_type":"code","metadata":{"id":"85iLnyb51Sgi","colab_type":"code","outputId":"c4f3fcce-c8c1-4ccd-d8f1-a463be74a93c","executionInfo":{"status":"ok","timestamp":1572961951358,"user_tz":-330,"elapsed":922,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":282}},"source":["plt.imshow(mnist.train.images[1].reshape(28,28))"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["<matplotlib.image.AxesImage at 0x7f69878d6e80>"]},"metadata":{"tags":[]},"execution_count":15},{"output_type":"display_data","data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0\ndHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAO+ElEQVR4nO3df5BV9XnH8c/juiwRAgKmFJHEX9AG\nZYJ1g22kiQ1NomQMpqlG2nHoDM2ajHbMTKajtZ0RJzMNsYk20xqTNVBJxhozSRypMVGKTJlEiywG\n+eHagAwU1oXVMAmQWGTZp3/sMbPRPd+z3HN/7T7v18zOvfc89+x55sJnz733e7/3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eshj\nZnvNbLuZbTWzrgb3strM+sxsx5BtU81snZntyi6HXWOvQb2tMLOe7LHbamaLG9TbLDPbYGYvmNlO\nM7sl297Qxy7RV10et7q/ZjezFkk/k/QhSQckbZa01N1fqGsjOcxsr6R2d2/4BzDM7P2Sjkn6prtf\nnG27S9Jhd1+Z/aGc4u63NklvKyQda/Qy3tlqRTOGLjMu6RpJf6UGPnaJvq5THR63RpzZF0ja7e57\n3P11Sd+WtKQBfTQ9d98o6fCbNi+RtCa7vkaD/1nqLqe3puDuve7+XHb9qKQ3lhlv6GOX6KsuGhH2\nmZL2D7l9QM213rtLetLMtphZR6ObGcZ0d+/Nrh+UNL2RzQyjcBnvenrTMuNN89hVsvx5WbxB91YL\n3f0PJF0l6abs6WpT8sHXYM00djqiZbzrZZhlxn+jkY9dpcufl9WIsPdImjXk9jnZtqbg7j3ZZZ+k\nR9R8S1EfemMF3eyyr8H9/EYzLeM93DLjaoLHrpHLnzci7JslzTaz88xsnKTrJa1tQB9vYWYTsjdO\nZGYTJH1YzbcU9VpJy7LryyQ92sBefkuzLOOdt8y4GvzYNXz5c3ev+4+kxRp8R/4lSX/fiB5y+jpf\n0vPZz85G9ybpIQ0+rTuhwfc2lkuaJmm9pF2S/lPS1Cbq7VuStkvapsFgzWhQbws1+BR9m6St2c/i\nRj92ib7q8rjxcVkgCN6gA4Ig7EAQhB0IgrADQRB2IAjCDgRB2IEg/h+E0IVyH5QeHwAAAABJRU5E\nrkJggg==\n","text/plain":["<Figure size 432x288 with 1 Axes>"]},"metadata":{"tags":[]}}]},{"cell_type":"code","metadata":{"id":"qffe3-pL1Sda","colab_type":"code","outputId":"5c949a68-ebad-42e5-8d4e-5ee7b8be6c3f","executionInfo":{"status":"ok","timestamp":1572962013666,"user_tz":-330,"elapsed":879,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":282}},"source":["plt.imshow(mnist.train.images[34543].reshape(28,28))"],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["<matplotlib.image.AxesImage at 0x7f69874023c8>"]},"metadata":{"tags":[]},"execution_count":17},{"output_type":"display_data","data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0\ndHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAOA0lEQVR4nO3df+xddX3H8deLUsqs0lIZXS2dUkRI\nJxnoN8UFYkCiQZKtdWaEbkNMgC9DSGAzmwyXUHHJmJk4M5hbgYayYFGnjJKRzdqREDMGfAsdFIqC\nXRmt/aFrSIthpT/e++N7cF/gez7ny/11rn0/H8k3997zvueed077uufe+7nnfhwRAnD4O6LtBgAM\nBmEHkiDsQBKEHUiCsANJHDnIjR3lGXG0Zg5yk0Aq/6uf6dXY58lqXYXd9vmSvippmqTbI+Km0v2P\n1kyd6fO62SSAgkdiXW2t45fxtqdJulXSxyUtkrTM9qJOHw9Af3Xznn2xpOcjYnNEvCrpHklLetMW\ngF7rJuzzJb044fbWatnr2B61PWZ7bL/2dbE5AN3o+6fxEbEiIkYiYmS6ZvR7cwBqdBP2bZIWTLh9\nQrUMwBDqJuyPSTrZ9om2j5J0kaQ1vWkLQK91PPQWEQdsXy3pXzU+9LYyIp7uWWcAeqqrcfaIeEDS\nAz3qBUAf8XVZIAnCDiRB2IEkCDuQBGEHkiDsQBKEHUiCsANJEHYgCcIOJEHYgSQIO5AEYQeSIOxA\nEoQdSIKwA0kQdiAJwg4kQdiBJAg7kARhB5Ig7EAShB1IgrADSRB2IAnCDiRB2IEkCDuQBGEHkuhq\nFlegTb/1zP8U66OzttTWzvvMlcV1f+m+Rztpa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BKEHUiCsANJEHYgCcIOJNH4U9I93Zj9E0kvTFh0nKT6\n+YbbNay9DWtfEr11qpe9vTsifnmywkDD/qaN22MRMdJaAwXD2tuw9iXRW6cG1Rsv44EkCDuQRNth\nX9Hy9kuGtbdh7Uuit04NpLdW37MDGJy2j+wABoSwA0m0Enbb59v+ge3nbV/XRg91bG+x/ZTtDbbH\nWu5lpe1dtjdOWDbH9lrbz1WXk86x11Jvy21vq/bdBtsXtNTbAtsP2n7G9tO2r6mWt7rvCn0NZL8N\n/D277WmSfijpo5K2SnpM0rKIeGagjdSwvUXSSES0/gUM2x+W9LKkuyLi/dWyL0naHRE3VU+Ux0bE\n54akt+WSXm57Gu9qtqJ5E6cZl7RU0qfV4r4r9HWhBrDf2jiyL5b0fERsjohXJd0jaUkLfQy9iHhI\n0u43LF4iaVV1fZXG/7MMXE1vQyEitkfE49X1vZJem2a81X1X6Gsg2gj7fEkvTri9VcM133tI+q7t\n9bZH225mEnMjYnt1fYekuW02M4nGabwH6Q3TjA/Nvutk+vNu8QHdm50dER+Q9HFJV1UvV4dSjL8H\nG6ax0ylN4z0ok0wz/nNt7rtOpz/vVhth3yZpwYTbJ1TLhkJEbKsud0m6V8M3FfXO12bQrS53tdzP\nzw3TNN6TTTOuIdh3bU5/3kbYH5N0su0TbR8l6SJJa1ro401sz6w+OJHtmZI+puGbinqNpEuq65dI\nuq/FXl5nWKbxrptmXC3vu9anP4+Igf9JukDjn8j/SNLn2+ihpq+Fkv6z+nu67d4krdb4y7r9Gv9s\n41JJ75S0TtJzkr4nac4Q9fYPkp6S9KTGgzWvpd7O1vhL9Cclbaj+Lmh73xX6Gsh+4+uyQBJ8QAck\nQdiBJAg7kARhB5Ig7EAShB1IgrADSfwficEmDCNfB4kAAAAASUVORK5CYII=\n","text/plain":["<Figure size 432x288 with 1 Axes>"]},"metadata":{"tags":[]}}]},{"cell_type":"code","metadata":{"id":"Kt-Bg2WH1SY6","colab_type":"code","outputId":"e8ffab7b-b93d-4a6c-d639-f412b91f6b70","executionInfo":{"status":"ok","timestamp":1572962094155,"user_tz":-330,"elapsed":976,"user":{"displayName":"HRITIK JAISWAL","photoUrl":"https://lh3.googleusercontent.com/a-/AAuE7mARQycAY7YzxPBbOEwWXoHNL-9_IUZnVdV5lsgliBk=s64","userId":"10596177819840519504"}},"colab":{"base_uri":"https://localhost:8080/","height":282}},"source":["plt.imshow(mnist.train.images[1].reshape(28,28), cmap='gist_gray')              "],"execution_count":0,"outputs":[{"output_type":"execute_result","data":{"text/plain":["<matplotlib.image.AxesImage at 0x7f698735d588>"]},"metadata":{"tags":[]},"execution_count":18},{"output_type":"display_data","data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0\ndHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAOHUlEQVR4nO3dXahd9ZnH8d9PbW/SXsScTAw2Jm2R\nSB0YK1EGJoZKaXy5SXJTGl/IMOopUqHRuZj4ghViggxjR3MTPUVpOlRLyQtKUVobSuLcSN4cjTlJ\ndSS+hJgXvajFi47mmYu9Uk71rP862e/nPN8PHPbe69nr7Mft+WWtvf57rb8jQgBmvvMG3QCA/iDs\nQBKEHUiCsANJEHYgiQv6+WK2OfQP9FhEeLLlHW3ZbV9v+4jtt2yv6+R3AegttzvObvt8SX+U9D1J\n70vaI2l1RBwqrMOWHeixXmzZr5b0VkS8HRF/kfQrSSs6+H0AeqiTsF8s6b0Jj9+vlv0N26O299re\n28FrAehQzw/QRcSYpDGJ3XhgkDrZsh+TtGDC469VywAMoU7CvkfSpba/bvvLkn4g6fnutAWg29re\njY+IT23fJem3ks6X9HREvNG1zgB0VdtDb229GJ/ZgZ7ryZdqAEwfhB1IgrADSRB2IAnCDiRB2IEk\nCDuQBGEHkiDsQBKEHUiCsANJE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2IEkCDuQBGEHkiDsQBKEHUiCsANJ/D9wJ73GNYCj\ndQAAAABJRU5ErkJggg==\n","text/plain":["<Figure size 432x288 with 1 Axes>"]},"metadata":{"tags":[]}}]},{"cell_type":"code","metadata":{"id":"6J-EdVg71SKC","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]}]}
Про Алгоритм
import tensorflow as tf

The default version of TensorFlow in Colab will soon switch to TensorFlow 2.x.
We recommend you upgrade now or ensure your notebook will continue to use TensorFlow 1.x via the %tensorflow_version 1.x magic: more info.

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/" , one_hot=True)
WARNING:tensorflow:From &amp;lt;ipython-input-4-c6bc8264dab0&amp;gt;:1: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Please write your own downloading logic.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/base.py:252: _internal_retry.&amp;lt;locals&amp;gt;.wrap.&amp;lt;locals&amp;gt;.wrapped_fn (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Please use urllib or similar directly.
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-images-idx3-ubyte.gz
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-labels-idx1-ubyte.gz
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:110: dense_to_one_hot (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.one_hot on tensors.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
type(mnist)
tensorflow.contrib.learn.python.learn.datasets.base.Datasets
mnist.train.images
array([[0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       ...,
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.]], dtype=float32)
mnist.train.num_examples
55000
mnist.test.num_examples
10000
#visualize the data

import matplotlib.pyplot as plt

%matplotlib inline
mnist.train.images[1].shape
(784,)
plt.imshow(mnist.train.images[1].reshape(28,28))
&lt;matplotlib.image.AxesImage at 0x7f69878d6e80&gt;
plt.imshow(mnist.train.images[34543].reshape(28,28))
&lt;matplotlib.image.AxesImage at 0x7f69874023c8&gt;
plt.imshow(mnist.train.images[1].reshape(28,28), cmap='gist_gray')              
&lt;matplotlib.image.AxesImage at 0x7f698735d588&gt;