{"cells":[{"cell_type":"markdown","metadata":{"_cell_guid":"43015531-7f0a-c40c-50e2-235d1b23c44d"},"source":"Just a quick look at the digits data..."},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"085506ee-6add-b801-4653-24c42dcc5f0b"},"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 matplotlib.pyplot as plt\nfrom matplotlib import cm\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":"markdown","metadata":{"_cell_guid":"32d32eec-9d7d-1f36-f480-8ae82367a0db"},"source":"Load in the data. Look at the training data set and see what the \"average\" digit looks like.\nAdd the standard deviation of the digits to the images."},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"30cf1925-f96a-3878-d0e8-c97d069c50c1"},"outputs":[],"source":"train=pd.read_csv('../input/train.csv')\n#print(train.head())\n\nfor i in range(10):\n    t=train[train.label==i]\n    \n    img=t.values[:,1:].mean(axis=0)\n    imgs=t.values[:,1:].std(axis=0)\n    \n    img=img.reshape(28,28)\n    imgs=imgs.reshape(28,28)\n    \n    plt.figure(1) \n    plt.subplot(2,5,i+1)\n    plt.title('$\\mu_' + str(i)+'$')\n    plt.imshow(img,cmap=cm.binary)\n    \n    plt.figure(2) \n    plt.subplot(2,5,i+1)\n    plt.title('$\\mu_' + str(i)+'+\\sigma_'+ str(i)+'$')\n    plt.imshow(imgs,cmap=cm.binary)\n\nplt.figure(3) \nplt.subplot(1,1,o)\n   plt.title('$\\mu_' + str(i)+'+\\sigma_'+ str(i)+'$')\n    plt.imshow(t.values[1,1:],cmap=cm.binary)\nplt.show()    "},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"216676e5-d37b-cbea-5765-abae0702a433"},"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}