{"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":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"train=pd.read_csv('../input/train.csv')\nmerchants=pd.read_csv('../input/merchants.csv')\ndata_dict=pd.read_excel('../input/Data_Dictionary.xlsx')\nhist_trans=pd.read_csv('../input/historical_transactions.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"scrolled":true,"_uuid":"df01b31ed5702e854dc268d54270f460184cda79"},"cell_type":"code","source":"hist_trans.head(10)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"0af682640ebf50e429d8ba641d0cf1b84f2a678d"},"cell_type":"code","source":"from sklearn.ensemble import RandomForestRegressor","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8bd341911cc4ae9dcc18c00c64e8edf6537cc7af"},"cell_type":"code","source":"from sklearn.neural_network import MLPRegressor","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"289456e22c0940073116772762e1c7ff0f6b5e88"},"cell_type":"code","source":"train.columns","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"7d2a3917cdf0e97a3ffafe8634aa21f2cf8cf7fa"},"cell_type":"markdown","source":"Random forest"},{"metadata":{"trusted":true,"_uuid":"469c3d61f22de4fd8b5be51baa010538e0c82494"},"cell_type":"code","source":"#model=RandomForestRegressor(n_estimators=1000)\n#model.fit(train[['feature_1', 'feature_2', 'feature_3']],train['target'])","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"75a3307aa432642f838317e538ffaf0f495a7186"},"cell_type":"markdown","source":"MLP"},{"metadata":{"trusted":true,"_uuid":"caba802898710823f4664e640ae444c1229c80eb"},"cell_type":"code","source":"model=MLPRegressor(hidden_layer_sizes=(100,100,100))\nmodel.fit(train[['feature_1', 'feature_2', 'feature_3']],train['target'])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1db20af519e61bf38df3d390e5ad08b801b0da1e"},"cell_type":"code","source":"test=pd.read_csv('../input/test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"4c5659b70f3d32f92676479fe4eb22e30b8cd009"},"cell_type":"code","source":"predicted=model.predict(test[['feature_1', 'feature_2', 'feature_3']])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"428a69294681b655d53458bcd96149b2163c9f2f"},"cell_type":"code","source":"predicted","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"116fa84615b82dab67b9179a20e03b9607346525"},"cell_type":"code","source":"output=pd.DataFrame()\noutput['card_id']=test['card_id']\noutput['target']=predicted\noutput.to_csv('output.csv',index=False)","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}