{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","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\nfrom sklearn import linear_model\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nfrom numpy import genfromtxt, savetxt\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\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"train_set = pd.read_csv('../input/train.csv')\ntrain_set.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a2aefbe1bdf7207bdb3ffea3379f64ac3792bd0c"},"cell_type":"code","source":"train_set_X = train_set.iloc[:, 1:]\ntrain_set_Y = train_set.iloc[:, 0]\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3233fac13c9cd0921d136399498b5660c8171527"},"cell_type":"code","source":"test_set_X = pd.read_csv('../input/test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5ed63600430c9f48a58d4803853683cd2d77b05e"},"cell_type":"code","source":"model = linear_model.SGDClassifier()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"22dca30a7a17b7dada8ca5f30bebb46fb4b61a27"},"cell_type":"code","source":"model.fit(train_set_X, train_set_Y)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"517be228144a0040e316da6be28011853657b8d5"},"cell_type":"code","source":"print(os.listdir(\"../input\"))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6cb65927bb01ddfa17cc75c19eca83cd9fe6d5d7"},"cell_type":"code","source":"train_set.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f7df3e86dea18d1ac7df60159287e22d4c20c0c7"},"cell_type":"code","source":"test_set_X.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d6d46efaf640e4408734f76c92c0889310e643c3"},"cell_type":"code","source":"prediction = model.predict(test_set_X)\nprediction","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a85596ce9f60a63c6c41e0a042540db3fb8ba937"},"cell_type":"code","source":"sm = pd.DataFrame({'ImageId': range(1, len(prediction) + 1), 'Label': prediction})\nsm.to_csv('my_submission.csv', index=False)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bf90f8bd34b75893739446d2e7e8e3c14d914659"},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}