{"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-09T08:37:42.918617Z","iopub.execute_input":"2023-01-09T08:37:42.919154Z","iopub.status.idle":"2023-01-09T08:37:48.763270Z","shell.execute_reply.started":"2023-01-09T08:37:42.919029Z","shell.execute_reply":"2023-01-09T08:37:48.761865Z"},"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-09T08:37:53.880760Z","iopub.execute_input":"2023-01-09T08:37:53.881670Z","iopub.status.idle":"2023-01-09T08:38:10.282386Z","shell.execute_reply.started":"2023-01-09T08:37:53.881614Z","shell.execute_reply":"2023-01-09T08:38:10.280975Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:38:15.186178Z","iopub.execute_input":"2023-01-09T08:38:15.186584Z","iopub.status.idle":"2023-01-09T08:38:15.223430Z","shell.execute_reply.started":"2023-01-09T08:38:15.186552Z","shell.execute_reply":"2023-01-09T08:38:15.222379Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:38:20.382576Z","iopub.execute_input":"2023-01-09T08:38:20.383640Z","iopub.status.idle":"2023-01-09T08:38:20.494022Z","shell.execute_reply.started":"2023-01-09T08:38:20.383591Z","shell.execute_reply":"2023-01-09T08:38:20.492581Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:38:24.777132Z","iopub.execute_input":"2023-01-09T08:38:24.777527Z","iopub.status.idle":"2023-01-09T08:38:24.860036Z","shell.execute_reply.started":"2023-01-09T08:38:24.777495Z","shell.execute_reply":"2023-01-09T08:38:24.858819Z"},"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-09T08:38:33.330322Z","iopub.execute_input":"2023-01-09T08:38:33.330737Z","iopub.status.idle":"2023-01-09T08:38:33.499225Z","shell.execute_reply.started":"2023-01-09T08:38:33.330703Z","shell.execute_reply":"2023-01-09T08:38:33.498083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_X = train_num.iloc[:, :-1]\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:38:37.603401Z","iopub.execute_input":"2023-01-09T08:38:37.603816Z","iopub.status.idle":"2023-01-09T08:38:37.688916Z","shell.execute_reply.started":"2023-01-09T08:38:37.603780Z","shell.execute_reply":"2023-01-09T08:38:37.687670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_y = train.iloc[:, -1]","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:38:43.257129Z","iopub.execute_input":"2023-01-09T08:38:43.257554Z","iopub.status.idle":"2023-01-09T08:38:43.263333Z","shell.execute_reply.started":"2023-01-09T08:38:43.257517Z","shell.execute_reply":"2023-01-09T08:38:43.262026Z"},"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-09T08:38:48.877522Z","iopub.execute_input":"2023-01-09T08:38:48.877927Z","iopub.status.idle":"2023-01-09T08:42:49.352331Z","shell.execute_reply.started":"2023-01-09T08:38:48.877894Z","shell.execute_reply":"2023-01-09T08:42:49.351139Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions = model.predict(test_num)\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:42:59.968478Z","iopub.execute_input":"2023-01-09T08:42:59.968923Z","iopub.status.idle":"2023-01-09T08:43:00.795466Z","shell.execute_reply.started":"2023-01-09T08:42:59.968888Z","shell.execute_reply":"2023-01-09T08:43:00.794371Z"},"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-09T08:43:04.197824Z","iopub.execute_input":"2023-01-09T08:43:04.198257Z","iopub.status.idle":"2023-01-09T08:43:05.457012Z","shell.execute_reply.started":"2023-01-09T08:43:04.198220Z","shell.execute_reply":"2023-01-09T08:43:05.455921Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.head()\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T08:43:09.193025Z","iopub.execute_input":"2023-01-09T08:43:09.193468Z","iopub.status.idle":"2023-01-09T08:43:09.204868Z","shell.execute_reply.started":"2023-01-09T08:43:09.193431Z","shell.execute_reply":"2023-01-09T08:43:09.203453Z"},"trusted":true},"execution_count":null,"outputs":[]}]}