{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"94f178fb-77a8-97ad-89fb-e7c697ff68f8"},"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)\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":"85604db9-bb9e-5e8f-b0fe-1690eacaff90"},"outputs":[],"source":"#Loading data\ntrain_data = pd.read_csv('../input/train.csv')\ntest_data = pd.read_csv('../input/test.csv').values.astype('float32')\nprint(train_data.shape)\nprint(test_data.shape)\ntrain_data.sample(5)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"b493b6f3-3257-bc1d-e68d-1cf3a502b8f5"},"outputs":[],"source":"#Separate the labels and images from the training data\ntrain_images = train_data.drop(['label'], axis=1).values.astype('float32')\ntrain_labels = train_data['label'].values.astype('int32')\nprint(train_images.shape)\nprint(train_labels.shape)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"9e34cac4-b057-5844-8611-8d7ba1dc12d9"},"outputs":[],"source":"#Reshape the input vectors into 3D images for the Convolutional \ntrain_images = train_images.reshape(-1, 28, 28, 1)\ntest_images = test_data.reshape(-1,28,28,1)\nprint(train_images.shape)\nprint(test_images.shape)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"7c998d47-4ed4-7000-1358-c04ad4a2c6e8"},"outputs":[],"source":"import torch\ntrain_images, test_images = torch.Tensor(train_images), torch.Tensor(test_images)"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"9e1ef25d-1e76-f740-8e40-3413cc49d8d9"},"outputs":[],"source":"import torch.nn as net\n\n"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"5cbc75c9-10ea-31b0-edbe-122987473704"},"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.6.0"}},"nbformat":4,"nbformat_minor":0}