{"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\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\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":{"trusted":true,"_uuid":"2c83e96d61f7acdd40d614efa927cfde14d803c8","scrolled":true},"cell_type":"code","source":"pd.read_csv('../input/train.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7315e3f74e7bdab6e14c28e53b1432dffee2baf0"},"cell_type":"code","source":"label=train['label']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ae81b46eb9c2cc8fc571896d6754bfc34b882d54"},"cell_type":"code","source":"label","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bad8f84f961ee221e7dab54411a2f4b81c8c899d"},"cell_type":"code","source":"train.drop('label',axis=1,inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"61796b7060439e8e4d4413407e2e887195d37ca4"},"cell_type":"code","source":"import sklearn as sk\nfrom sklearn.model_selection import train_test_split","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"135aedfb04b92e6a27ed15fefe6c66a95bdd8457"},"cell_type":"code","source":"x_train,x_test,y_train,y_test=train_test_split(train,label,test_size=0.2)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"af7b69c2da5e535e001eb4abad670be6dc974bb7"},"cell_type":"code","source":"from sklearn.linear_model import LogisticRegression","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"384178f0ffda907cc986d61b77136462561a9459"},"cell_type":"code","source":"gln=LogisticRegression(n_jobs=-1,solver='lbfgs')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"227af4433caa3a91dfc6e6967bafe67e11b1f94b"},"cell_type":"code","source":"gln.fit(x_train,y_train)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"647ee5c05e940c35e230c80ffcd01f20e4ab53c8"},"cell_type":"code","source":"import matplotlib.pyplot as plt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a207af44fc91d577148797e337583b4889e830f2"},"cell_type":"code","source":"pred=x_train.iloc[0,:]\npred=np.array(pred)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"2fbfe2819265c8b1b13102e8b26a6b4f52f9733c"},"cell_type":"code","source":"gln.predict(pred.reshape(1,-1))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"61db0fc94716b27c68ab54c8a3e6140163f4e8eb"},"cell_type":"code","source":"plt.imshow(pred.reshape(28,28))","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}