{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"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\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport tensorflow as tf\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input/emsi-5iir-ds'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","editable":false,"execution":{"iopub.status.busy":"2023-01-08T17:30:02.177698Z","iopub.execute_input":"2023-01-08T17:30:02.178163Z","iopub.status.idle":"2023-01-08T17:30:02.187141Z","shell.execute_reply.started":"2023-01-08T17:30:02.178123Z","shell.execute_reply":"2023-01-08T17:30:02.185715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/emsi-5iir-ds/train.csv\", index_col=\"id\")\ntest = pd.read_csv(\"/kaggle/input/emsi-5iir-ds/test.csv\", index_col=\"id\")\nsubmission = pd.read_csv('../input/emsi-5iir-ds/sample_submission.csv')\n\nprint(\"Train Set:\", train.shape, \"Test Set:\", test.shape)","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:02.212739Z","iopub.execute_input":"2023-01-08T17:30:02.213516Z","iopub.status.idle":"2023-01-08T17:30:12.738806Z","shell.execute_reply.started":"2023-01-08T17:30:02.213477Z","shell.execute_reply":"2023-01-08T17:30:12.737444Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:12.740929Z","iopub.execute_input":"2023-01-08T17:30:12.741518Z","iopub.status.idle":"2023-01-08T17:30:12.767706Z","shell.execute_reply.started":"2023-01-08T17:30:12.741470Z","shell.execute_reply":"2023-01-08T17:30:12.766184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:12.769187Z","iopub.execute_input":"2023-01-08T17:30:12.769632Z","iopub.status.idle":"2023-01-08T17:30:12.879161Z","shell.execute_reply.started":"2023-01-08T17:30:12.769571Z","shell.execute_reply":"2023-01-08T17:30:12.877898Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:12.882026Z","iopub.execute_input":"2023-01-08T17:30:12.882567Z","iopub.status.idle":"2023-01-08T17:30:12.966950Z","shell.execute_reply.started":"2023-01-08T17:30:12.882523Z","shell.execute_reply":"2023-01-08T17:30:12.965707Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_num = train.drop('f_27', axis=1)\ntest_num = test.drop('f_27', axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:12.968295Z","iopub.execute_input":"2023-01-08T17:30:12.970162Z","iopub.status.idle":"2023-01-08T17:30:13.055207Z","shell.execute_reply.started":"2023-01-08T17:30:12.970103Z","shell.execute_reply":"2023-01-08T17:30:13.053962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_X = train_num.iloc[:, :-1]\n","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:13.056651Z","iopub.execute_input":"2023-01-08T17:30:13.057112Z","iopub.status.idle":"2023-01-08T17:30:13.120891Z","shell.execute_reply.started":"2023-01-08T17:30:13.057068Z","shell.execute_reply":"2023-01-08T17:30:13.119482Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_y = train.iloc[:, -1]","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:13.122274Z","iopub.execute_input":"2023-01-08T17:30:13.123058Z","iopub.status.idle":"2023-01-08T17:30:13.135081Z","shell.execute_reply.started":"2023-01-08T17:30:13.123018Z","shell.execute_reply":"2023-01-08T17:30:13.133520Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from xgboost import XGBRegressor\n\nmodel = XGBRegressor()\nmodel.fit(train_X, train_y, verbose=False)","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:30:13.136126Z","iopub.execute_input":"2023-01-08T17:30:13.136474Z","iopub.status.idle":"2023-01-08T17:34:28.412770Z","shell.execute_reply.started":"2023-01-08T17:30:13.136441Z","shell.execute_reply":"2023-01-08T17:34:28.411652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions = model.predict(test_num)\n","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:34:28.414509Z","iopub.execute_input":"2023-01-08T17:34:28.415529Z","iopub.status.idle":"2023-01-08T17:34:29.276294Z","shell.execute_reply.started":"2023-01-08T17:34:28.415478Z","shell.execute_reply":"2023-01-08T17:34:29.275285Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission['target'] = predictions\nsubmission.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:34:29.279831Z","iopub.execute_input":"2023-01-08T17:34:29.280712Z","iopub.status.idle":"2023-01-08T17:34:30.542005Z","shell.execute_reply.started":"2023-01-08T17:34:29.280655Z","shell.execute_reply":"2023-01-08T17:34:30.540676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.head()\n","metadata":{"execution":{"iopub.status.busy":"2023-01-08T17:34:30.543676Z","iopub.execute_input":"2023-01-08T17:34:30.544059Z","iopub.status.idle":"2023-01-08T17:34:30.556050Z","shell.execute_reply.started":"2023-01-08T17:34:30.544026Z","shell.execute_reply":"2023-01-08T17:34:30.554575Z"},"trusted":true},"execution_count":null,"outputs":[]}]}