{"cells":[{"cell_type":"markdown","metadata":{"_cell_guid":"0a7a2a0d-65f2-b1b0-066d-c0454e7f20a6"},"source":""},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"bdab7a24-5f15-ed19-6d43-6176fd20d925"},"outputs":[],"source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport tensorflow as tf\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nfrom subprocess import check_output\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n\n# Any results you write to the current directory are saved as output."},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"2b6b144a-4b22-94a3-7329-765a0ef332a7"},"outputs":[],"source":"#read our data and set up tensorflow\ntraindf = pd.read_csv('../input/test.csv')\n\nx = tf.placeholder(tf.float32, [None, 784])\nW = tf.Variable(tf.zeros([784, 10]))\nb = tf.Variable(tf.zeros([10]))\ny = tf.nn.softmax(tf.matmul(x, W) + b)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"dff70cc9-2278-31cc-ae15-f12362fe2623"},"outputs":[],"source":"y_ = tf.placeholder(tf.float32, [None, 10])\ncross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))\ntrain_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"1c743437-23a1-ffe9-44d6-34de8e89709e"},"outputs":[],"source":"init = tf.global_variables_initializer()\nsess = tf.Session()\nsess.run(init)\nfor i in range(1000):\n  batch_xs, batch_ys = mnist.train.next_batch(100)\n  sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})\n    "},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"26821090-c6b9-d99c-10b5-1a0a74b78677"},"outputs":[],"source":"from tensorflow.examples.tutorials.mnist import input_data\nmnist = input_data.read_data_sets(\"MNIST_data/\", one_hot=True)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"41783571-fb14-934a-1e35-4d8923e27e24"},"outputs":[],"source":"mnist"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"575eaf40-7113-a207-73c1-4363d5871a64"},"outputs":[],"source":""}],"metadata":{"_change_revision":0,"_is_fork":false,"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.5.2"}},"nbformat":4,"nbformat_minor":0}