{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":60182,"databundleVersionId":6787572,"sourceType":"competition"}],"dockerImageVersionId":30558,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"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)\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'):\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","execution":{"iopub.status.busy":"2024-08-31T12:14:14.805684Z","iopub.execute_input":"2024-08-31T12:14:14.806185Z","iopub.status.idle":"2024-08-31T12:14:15.384963Z","shell.execute_reply.started":"2024-08-31T12:14:14.806137Z","shell.execute_reply":"2024-08-31T12:14:15.383272Z"},"trusted":true},"execution_count":1,"outputs":[{"name":"stdout","text":"/kaggle/input/earthquake-prediction/sample_submission_long.csv\n/kaggle/input/earthquake-prediction/train.csv\n/kaggle/input/earthquake-prediction/test.csv\n","output_type":"stream"}]},{"cell_type":"code","source":"df=pd.read_csv('')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport dask.dataframe as dd\nimport xgboost as xgb\n\ncolumn_names = [\"ae_\" + str(i) for i in range(1, 6001)]\n# Step 1: Load the data\ntrain_data = dd.read_csv('/kaggle/input/earthquake-prediction/train.csv')","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:14:36.494384Z","iopub.execute_input":"2024-08-31T12:14:36.495044Z","iopub.status.idle":"2024-08-31T12:14:39.166829Z","shell.execute_reply.started":"2024-08-31T12:14:36.495004Z","shell.execute_reply":"2024-08-31T12:14:39.165314Z"},"trusted":true},"execution_count":2,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_types = {col: 'int32' if col.startswith(\"ae_\") else 'float64' for col in train_data.columns}\ntrain_data = pd.read_csv('/kaggle/input/earthquake-prediction/train.csv', dtype=data_types)\ntest_data = pd.read_csv('/kaggle/input/earthquake-prediction/test.csv', dtype=data_types)","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:14:45.343815Z","iopub.execute_input":"2024-08-31T12:14:45.344913Z","iopub.status.idle":"2024-08-31T12:22:51.083793Z","shell.execute_reply.started":"2024-08-31T12:14:45.344843Z","shell.execute_reply":"2024-08-31T12:22:51.082523Z"},"trusted":true},"execution_count":3,"outputs":[]},{"cell_type":"code","source":"memory_usage = train_data.memory_usage(deep=True).sum() / (1024**2)  # Convert to megabytes\nmemory_usage2 = test_data.memory_usage(deep=True).sum() / (1024**2)  # Convert to megabytes\n\nprint(f\"Memory usage of train_data/test_data: {memory_usage:.2f} MB  {memory_usage2:.2f} MB\")","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:23:15.306659Z","iopub.execute_input":"2024-08-31T12:23:15.308979Z","iopub.status.idle":"2024-08-31T12:23:16.264034Z","shell.execute_reply.started":"2024-08-31T12:23:15.308919Z","shell.execute_reply":"2024-08-31T12:23:16.262925Z"},"trusted":true},"execution_count":4,"outputs":[{"name":"stdout","text":"Memory usage of train_data/test_data: 3625.45 MB  3692.59 MB\n","output_type":"stream"}]},{"cell_type":"code","source":"train_data.to_parquet('/kaggle/working/train.parquet.gzip', index=False)\ntest_data.to_parquet('/kaggle/working/test.parquet.gzip', index=False)","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:23:19.23678Z","iopub.execute_input":"2024-08-31T12:23:19.237232Z","iopub.status.idle":"2024-08-31T12:24:07.940727Z","shell.execute_reply.started":"2024-08-31T12:23:19.237196Z","shell.execute_reply":"2024-08-31T12:24:07.939497Z"},"trusted":true},"execution_count":5,"outputs":[]},{"cell_type":"code","source":"# train_data=pd.read_parquet('/kaggle/working/train.parquet.gzip')\n# test_data=pd.read_parquet('/kaggle/working/test.parquet.gzip')","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:25:48.638062Z","iopub.execute_input":"2024-08-31T12:25:48.638502Z","iopub.status.idle":"2024-08-31T12:25:48.643618Z","shell.execute_reply.started":"2024-08-31T12:25:48.63847Z","shell.execute_reply":"2024-08-31T12:25:48.642427Z"},"trusted":true},"execution_count":7,"outputs":[]},{"cell_type":"code","source":"train_data.dtypes","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:25:53.974162Z","iopub.execute_input":"2024-08-31T12:25:53.974603Z","iopub.status.idle":"2024-08-31T12:25:53.991189Z","shell.execute_reply.started":"2024-08-31T12:25:53.974568Z","shell.execute_reply":"2024-08-31T12:25:53.989823Z"},"trusted":true},"execution_count":8,"outputs":[{"execution_count":8,"output_type":"execute_result","data":{"text/plain":"time_stamp       float64\nae_1               int32\nae_2               int32\nae_3               int32\nae_4               int32\n                  ...   \nttf              float64\nEP_disp          float64\nEP_disp_FUT_1    float64\nEP_disp_FUT_2    float64\nEP_disp_FUT_3    float64\nLength: 6006, dtype: object"},"metadata":{}}]},{"cell_type":"code","source":"train_data.shape, test_data.shape, ","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:25:58.118847Z","iopub.execute_input":"2024-08-31T12:25:58.119285Z","iopub.status.idle":"2024-08-31T12:25:58.126903Z","shell.execute_reply.started":"2024-08-31T12:25:58.11925Z","shell.execute_reply":"2024-08-31T12:25:58.125695Z"},"trusted":true},"execution_count":9,"outputs":[{"execution_count":9,"output_type":"execute_result","data":{"text/plain":"((158082, 6006), (161278, 6001))"},"metadata":{}}]},{"cell_type":"code","source":"train_data.head()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:00.093977Z","iopub.execute_input":"2024-08-31T12:26:00.094423Z","iopub.status.idle":"2024-08-31T12:26:00.13006Z","shell.execute_reply.started":"2024-08-31T12:26:00.094378Z","shell.execute_reply":"2024-08-31T12:26:00.128933Z"},"trusted":true},"execution_count":10,"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":"    time_stamp  ae_1  ae_2  ae_3  ae_4  ae_5  ae_6  ae_7  ae_8  ae_9  ...  \\\n0  2681.652667     0     0     0     0     0     0     0     0     0  ...   \n1  2681.653506    -3    -2     4     3     0     1     5    13     2  ...   \n2  2681.654345     2     2     6     0     6     0    -4    -4     5  ...   \n3  2681.655184     2     6    11     2     2     1    -4     1    -4  ...   \n4  2681.656023     5     3   -10    -8    -2    -3     2     0    -4  ...   \n\n   ae_5996  ae_5997  ae_5998  ae_5999  ae_6000       ttf   EP_disp  \\\n0        1       -2       -3       -1        3  5.966095  3.983782   \n1        4        0        1       -1        3  5.965256  3.983932   \n2       -4       -9       -3        0       -5  5.964417  3.983899   \n3       -1       -3       -5        0        6  5.963578  3.983665   \n4       -8       -4        1       -1        1  5.962739  3.983484   \n\n   EP_disp_FUT_1  EP_disp_FUT_2  EP_disp_FUT_3  \n0       3.983932       3.983899       3.983665  \n1       3.983899       3.983665       3.983484  \n2       3.983665       3.983484       3.983428  \n3       3.983484       3.983428       3.983444  \n4       3.983428       3.983444       3.983478  \n\n[5 rows x 6006 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>time_stamp</th>\n      <th>ae_1</th>\n      <th>ae_2</th>\n      <th>ae_3</th>\n      <th>ae_4</th>\n      <th>ae_5</th>\n      <th>ae_6</th>\n      <th>ae_7</th>\n      <th>ae_8</th>\n      <th>ae_9</th>\n      <th>...</th>\n      <th>ae_5996</th>\n      <th>ae_5997</th>\n      <th>ae_5998</th>\n      <th>ae_5999</th>\n      <th>ae_6000</th>\n      <th>ttf</th>\n      <th>EP_disp</th>\n      <th>EP_disp_FUT_1</th>\n      <th>EP_disp_FUT_2</th>\n      <th>EP_disp_FUT_3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2681.652667</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>...</td>\n      <td>1</td>\n      <td>-2</td>\n      <td>-3</td>\n      <td>-1</td>\n      <td>3</td>\n      <td>5.966095</td>\n      <td>3.983782</td>\n      <td>3.983932</td>\n      <td>3.983899</td>\n      <td>3.983665</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2681.653506</td>\n      <td>-3</td>\n      <td>-2</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>5</td>\n      <td>13</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>0</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>3</td>\n      <td>5.965256</td>\n      <td>3.983932</td>\n      <td>3.983899</td>\n      <td>3.983665</td>\n      <td>3.983484</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2681.654345</td>\n      <td>2</td>\n      <td>2</td>\n      <td>6</td>\n      <td>0</td>\n      <td>6</td>\n      <td>0</td>\n      <td>-4</td>\n      <td>-4</td>\n      <td>5</td>\n      <td>...</td>\n      <td>-4</td>\n      <td>-9</td>\n      <td>-3</td>\n      <td>0</td>\n      <td>-5</td>\n      <td>5.964417</td>\n      <td>3.983899</td>\n      <td>3.983665</td>\n      <td>3.983484</td>\n      <td>3.983428</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2681.655184</td>\n      <td>2</td>\n      <td>6</td>\n      <td>11</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>-4</td>\n      <td>1</td>\n      <td>-4</td>\n      <td>...</td>\n      <td>-1</td>\n      <td>-3</td>\n      <td>-5</td>\n      <td>0</td>\n      <td>6</td>\n      <td>5.963578</td>\n      <td>3.983665</td>\n      <td>3.983484</td>\n      <td>3.983428</td>\n      <td>3.983444</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2681.656023</td>\n      <td>5</td>\n      <td>3</td>\n      <td>-10</td>\n      <td>-8</td>\n      <td>-2</td>\n      <td>-3</td>\n      <td>2</td>\n      <td>0</td>\n      <td>-4</td>\n      <td>...</td>\n      <td>-8</td>\n      <td>-4</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>5.962739</td>\n      <td>3.983484</td>\n      <td>3.983428</td>\n      <td>3.983444</td>\n      <td>3.983478</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 6006 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"train_data.tail()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:03.311213Z","iopub.execute_input":"2024-08-31T12:26:03.311728Z","iopub.status.idle":"2024-08-31T12:26:03.339266Z","shell.execute_reply.started":"2024-08-31T12:26:03.311689Z","shell.execute_reply":"2024-08-31T12:26:03.338001Z"},"trusted":true},"execution_count":11,"outputs":[{"execution_count":11,"output_type":"execute_result","data":{"text/plain":"         time_stamp  ae_1  ae_2  ae_3  ae_4  ae_5  ae_6  ae_7  ae_8  ae_9  \\\n158077  2814.278522    -4     0     5     3    -2    -1    -2    -2     5   \n158078  2814.279361     3    -3     0     1     2     2     4     9     2   \n158079  2814.280200     3    -2    -3     4     3    -2    -5     0     2   \n158080  2814.281039     0     0     0     0     0     0     0     0     0   \n158081  2814.281878     8    14     5     2     0    -1    -2     3     2   \n\n        ...  ae_5996  ae_5997  ae_5998  ae_5999  ae_6000       ttf   EP_disp  \\\n158077  ...        1       -1        0       -5       -2  4.306563  5.248705   \n158078  ...        1        2        1        2        7  4.305724  5.248709   \n158079  ...        1       -5       -1       -1        1  4.304885  5.248623   \n158080  ...        6        1        0       -2       -3  4.304046  5.248466   \n158081  ...       -1        0        2        2        9  4.303207  5.248456   \n\n        EP_disp_FUT_1  EP_disp_FUT_2  EP_disp_FUT_3  \n158077       5.248709       5.248623       5.248466  \n158078       5.248623       5.248466       5.248456  \n158079       5.248466       5.248456      -1.000000  \n158080       5.248456      -1.000000      -1.000000  \n158081      -1.000000      -1.000000      -1.000000  \n\n[5 rows x 6006 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>time_stamp</th>\n      <th>ae_1</th>\n      <th>ae_2</th>\n      <th>ae_3</th>\n      <th>ae_4</th>\n      <th>ae_5</th>\n      <th>ae_6</th>\n      <th>ae_7</th>\n      <th>ae_8</th>\n      <th>ae_9</th>\n      <th>...</th>\n      <th>ae_5996</th>\n      <th>ae_5997</th>\n      <th>ae_5998</th>\n      <th>ae_5999</th>\n      <th>ae_6000</th>\n      <th>ttf</th>\n      <th>EP_disp</th>\n      <th>EP_disp_FUT_1</th>\n      <th>EP_disp_FUT_2</th>\n      <th>EP_disp_FUT_3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>158077</th>\n      <td>2814.278522</td>\n      <td>-4</td>\n      <td>0</td>\n      <td>5</td>\n      <td>3</td>\n      <td>-2</td>\n      <td>-1</td>\n      <td>-2</td>\n      <td>-2</td>\n      <td>5</td>\n      <td>...</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>0</td>\n      <td>-5</td>\n      <td>-2</td>\n      <td>4.306563</td>\n      <td>5.248705</td>\n      <td>5.248709</td>\n      <td>5.248623</td>\n      <td>5.248466</td>\n    </tr>\n    <tr>\n      <th>158078</th>\n      <td>2814.279361</td>\n      <td>3</td>\n      <td>-3</td>\n      <td>0</td>\n      <td>1</td>\n      <td>2</td>\n      <td>2</td>\n      <td>4</td>\n      <td>9</td>\n      <td>2</td>\n      <td>...</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>7</td>\n      <td>4.305724</td>\n      <td>5.248709</td>\n      <td>5.248623</td>\n      <td>5.248466</td>\n      <td>5.248456</td>\n    </tr>\n    <tr>\n      <th>158079</th>\n      <td>2814.280200</td>\n      <td>3</td>\n      <td>-2</td>\n      <td>-3</td>\n      <td>4</td>\n      <td>3</td>\n      <td>-2</td>\n      <td>-5</td>\n      <td>0</td>\n      <td>2</td>\n      <td>...</td>\n      <td>1</td>\n      <td>-5</td>\n      <td>-1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>4.304885</td>\n      <td>5.248623</td>\n      <td>5.248466</td>\n      <td>5.248456</td>\n      <td>-1.000000</td>\n    </tr>\n    <tr>\n      <th>158080</th>\n      <td>2814.281039</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>...</td>\n      <td>6</td>\n      <td>1</td>\n      <td>0</td>\n      <td>-2</td>\n      <td>-3</td>\n      <td>4.304046</td>\n      <td>5.248466</td>\n      <td>5.248456</td>\n      <td>-1.000000</td>\n      <td>-1.000000</td>\n    </tr>\n    <tr>\n      <th>158081</th>\n      <td>2814.281878</td>\n      <td>8</td>\n      <td>14</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>...</td>\n      <td>-1</td>\n      <td>0</td>\n      <td>2</td>\n      <td>2</td>\n      <td>9</td>\n      <td>4.303207</td>\n      <td>5.248456</td>\n      <td>-1.000000</td>\n      <td>-1.000000</td>\n      <td>-1.000000</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 6006 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"test_data.head()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:05.974395Z","iopub.execute_input":"2024-08-31T12:26:05.974915Z","iopub.status.idle":"2024-08-31T12:26:05.99805Z","shell.execute_reply.started":"2024-08-31T12:26:05.974874Z","shell.execute_reply":"2024-08-31T12:26:05.996825Z"},"trusted":true},"execution_count":12,"outputs":[{"execution_count":12,"output_type":"execute_result","data":{"text/plain":"    time_stamp  ae_1  ae_2  ae_3  ae_4  ae_5  ae_6  ae_7  ae_8  ae_9  ...  \\\n0  2814.282717     0     0    -1    -2    -1     6     3     1     3  ...   \n1  2814.283556    -2     5     6     0     5     9     5    -3    -5  ...   \n2  2814.284395     3     0    -3    -6     9     6    -2    -4   -10  ...   \n3  2814.285234     6     6     3    -3    -5     3     5    -2     0  ...   \n4  2814.286073    -1     2     6    -8    -1     3    -1     3    -6  ...   \n\n   ae_5991  ae_5992  ae_5993  ae_5994  ae_5995  ae_5996  ae_5997  ae_5998  \\\n0        7        5        1        1        3        7        6        8   \n1        7        0       -4       -4       -2       -1       -9       -3   \n2        7       -4       -5        3        3        9       -2       -7   \n3        1        2        5        2       -7        8        7       -3   \n4        6       -1        3        3        2        6        1        2   \n\n   ae_5999  ae_6000  \n0       11        0  \n1       -3       -8  \n2       -7       -2  \n3       -2       -4  \n4       -5       -4  \n\n[5 rows x 6001 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>time_stamp</th>\n      <th>ae_1</th>\n      <th>ae_2</th>\n      <th>ae_3</th>\n      <th>ae_4</th>\n      <th>ae_5</th>\n      <th>ae_6</th>\n      <th>ae_7</th>\n      <th>ae_8</th>\n      <th>ae_9</th>\n      <th>...</th>\n      <th>ae_5991</th>\n      <th>ae_5992</th>\n      <th>ae_5993</th>\n      <th>ae_5994</th>\n      <th>ae_5995</th>\n      <th>ae_5996</th>\n      <th>ae_5997</th>\n      <th>ae_5998</th>\n      <th>ae_5999</th>\n      <th>ae_6000</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2814.282717</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-2</td>\n      <td>-1</td>\n      <td>6</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>...</td>\n      <td>7</td>\n      <td>5</td>\n      <td>1</td>\n      <td>1</td>\n      <td>3</td>\n      <td>7</td>\n      <td>6</td>\n      <td>8</td>\n      <td>11</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2814.283556</td>\n      <td>-2</td>\n      <td>5</td>\n      <td>6</td>\n      <td>0</td>\n      <td>5</td>\n      <td>9</td>\n      <td>5</td>\n      <td>-3</td>\n      <td>-5</td>\n      <td>...</td>\n      <td>7</td>\n      <td>0</td>\n      <td>-4</td>\n      <td>-4</td>\n      <td>-2</td>\n      <td>-1</td>\n      <td>-9</td>\n      <td>-3</td>\n      <td>-3</td>\n      <td>-8</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2814.284395</td>\n      <td>3</td>\n      <td>0</td>\n      <td>-3</td>\n      <td>-6</td>\n      <td>9</td>\n      <td>6</td>\n      <td>-2</td>\n      <td>-4</td>\n      <td>-10</td>\n      <td>...</td>\n      <td>7</td>\n      <td>-4</td>\n      <td>-5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>9</td>\n      <td>-2</td>\n      <td>-7</td>\n      <td>-7</td>\n      <td>-2</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2814.285234</td>\n      <td>6</td>\n      <td>6</td>\n      <td>3</td>\n      <td>-3</td>\n      <td>-5</td>\n      <td>3</td>\n      <td>5</td>\n      <td>-2</td>\n      <td>0</td>\n      <td>...</td>\n      <td>1</td>\n      <td>2</td>\n      <td>5</td>\n      <td>2</td>\n      <td>-7</td>\n      <td>8</td>\n      <td>7</td>\n      <td>-3</td>\n      <td>-2</td>\n      <td>-4</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2814.286073</td>\n      <td>-1</td>\n      <td>2</td>\n      <td>6</td>\n      <td>-8</td>\n      <td>-1</td>\n      <td>3</td>\n      <td>-1</td>\n      <td>3</td>\n      <td>-6</td>\n      <td>...</td>\n      <td>6</td>\n      <td>-1</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>6</td>\n      <td>1</td>\n      <td>2</td>\n      <td>-5</td>\n      <td>-4</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 6001 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"test_data.tail()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:09.022029Z","iopub.execute_input":"2024-08-31T12:26:09.023106Z","iopub.status.idle":"2024-08-31T12:26:09.046797Z","shell.execute_reply.started":"2024-08-31T12:26:09.023065Z","shell.execute_reply":"2024-08-31T12:26:09.04538Z"},"trusted":true},"execution_count":13,"outputs":[{"execution_count":13,"output_type":"execute_result","data":{"text/plain":"         time_stamp  ae_1  ae_2  ae_3  ae_4  ae_5  ae_6  ae_7  ae_8  ae_9  \\\n161273  2949.590001    -2    -1    -2     1    -1     2    -3    -4    -5   \n161274  2949.590840     3     5    -5    -1     0    -1     4    -5     2   \n161275  2949.591679     0    -1    -4     4     1     0     3     4    -1   \n161276  2949.592518    10     6     7     8    -1     2     2    -3    -3   \n161277  2949.593357     5     3    -4     1     9     9     3    -2    -6   \n\n        ...  ae_5991  ae_5992  ae_5993  ae_5994  ae_5995  ae_5996  ae_5997  \\\n161273  ...        7        4        0       -1        1       -4        1   \n161274  ...        6       -7       -4       -5        0        0       -1   \n161275  ...        0        5       -1       -2       -4        4        8   \n161276  ...        2        3       -1       -2       -5       -8      -10   \n161277  ...        1       -1        1       -3        1        2        3   \n\n        ae_5998  ae_5999  ae_6000  \n161273        2        4        1  \n161274        0        3        3  \n161275        4       -1       -7  \n161276       -4        1        2  \n161277        5        0       -1  \n\n[5 rows x 6001 columns]","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>time_stamp</th>\n      <th>ae_1</th>\n      <th>ae_2</th>\n      <th>ae_3</th>\n      <th>ae_4</th>\n      <th>ae_5</th>\n      <th>ae_6</th>\n      <th>ae_7</th>\n      <th>ae_8</th>\n      <th>ae_9</th>\n      <th>...</th>\n      <th>ae_5991</th>\n      <th>ae_5992</th>\n      <th>ae_5993</th>\n      <th>ae_5994</th>\n      <th>ae_5995</th>\n      <th>ae_5996</th>\n      <th>ae_5997</th>\n      <th>ae_5998</th>\n      <th>ae_5999</th>\n      <th>ae_6000</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>161273</th>\n      <td>2949.590001</td>\n      <td>-2</td>\n      <td>-1</td>\n      <td>-2</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>2</td>\n      <td>-3</td>\n      <td>-4</td>\n      <td>-5</td>\n      <td>...</td>\n      <td>7</td>\n      <td>4</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>-4</td>\n      <td>1</td>\n      <td>2</td>\n      <td>4</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>161274</th>\n      <td>2949.590840</td>\n      <td>3</td>\n      <td>5</td>\n      <td>-5</td>\n      <td>-1</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>4</td>\n      <td>-5</td>\n      <td>2</td>\n      <td>...</td>\n      <td>6</td>\n      <td>-7</td>\n      <td>-4</td>\n      <td>-5</td>\n      <td>0</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>0</td>\n      <td>3</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>161275</th>\n      <td>2949.591679</td>\n      <td>0</td>\n      <td>-1</td>\n      <td>-4</td>\n      <td>4</td>\n      <td>1</td>\n      <td>0</td>\n      <td>3</td>\n      <td>4</td>\n      <td>-1</td>\n      <td>...</td>\n      <td>0</td>\n      <td>5</td>\n      <td>-1</td>\n      <td>-2</td>\n      <td>-4</td>\n      <td>4</td>\n      <td>8</td>\n      <td>4</td>\n      <td>-1</td>\n      <td>-7</td>\n    </tr>\n    <tr>\n      <th>161276</th>\n      <td>2949.592518</td>\n      <td>10</td>\n      <td>6</td>\n      <td>7</td>\n      <td>8</td>\n      <td>-1</td>\n      <td>2</td>\n      <td>2</td>\n      <td>-3</td>\n      <td>-3</td>\n      <td>...</td>\n      <td>2</td>\n      <td>3</td>\n      <td>-1</td>\n      <td>-2</td>\n      <td>-5</td>\n      <td>-8</td>\n      <td>-10</td>\n      <td>-4</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>161277</th>\n      <td>2949.593357</td>\n      <td>5</td>\n      <td>3</td>\n      <td>-4</td>\n      <td>1</td>\n      <td>9</td>\n      <td>9</td>\n      <td>3</td>\n      <td>-2</td>\n      <td>-6</td>\n      <td>...</td>\n      <td>1</td>\n      <td>-1</td>\n      <td>1</td>\n      <td>-3</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>5</td>\n      <td>0</td>\n      <td>-1</td>\n    </tr>\n  </tbody>\n</table>\n<p>5 rows × 6001 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"sample_submission_long= pd.read_csv('/kaggle/input/earthquake-prediction/sample_submission_long.csv')\nsample_submission_long.head()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:11.687872Z","iopub.execute_input":"2024-08-31T12:26:11.688306Z","iopub.status.idle":"2024-08-31T12:26:11.866547Z","shell.execute_reply.started":"2024-08-31T12:26:11.688269Z","shell.execute_reply":"2024-08-31T12:26:11.865271Z"},"trusted":true},"execution_count":14,"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":"   index   time_stamp  ttf  EP_disp  EP_disp_FUT_1  EP_disp_FUT_2  \\\n0      1  2814.286073    0        0              0              0   \n1      2  2814.286912    0        0              0              0   \n2      3  2814.287751    0        0              0              0   \n3      4  2814.288590    0        0              0              0   \n4      5  2814.289429    0        0              0              0   \n\n   EP_disp_FUT_3  \n0              0  \n1              0  \n2              0  \n3              0  \n4              0  ","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>index</th>\n      <th>time_stamp</th>\n      <th>ttf</th>\n      <th>EP_disp</th>\n      <th>EP_disp_FUT_1</th>\n      <th>EP_disp_FUT_2</th>\n      <th>EP_disp_FUT_3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1</td>\n      <td>2814.286073</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2</td>\n      <td>2814.286912</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>3</td>\n      <td>2814.287751</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>4</td>\n      <td>2814.288590</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>5</td>\n      <td>2814.289429</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"sample_submission_long.shape","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:14.558135Z","iopub.execute_input":"2024-08-31T12:26:14.558538Z","iopub.status.idle":"2024-08-31T12:26:14.565959Z","shell.execute_reply.started":"2024-08-31T12:26:14.558508Z","shell.execute_reply":"2024-08-31T12:26:14.564807Z"},"trusted":true},"execution_count":15,"outputs":[{"execution_count":15,"output_type":"execute_result","data":{"text/plain":"(161274, 7)"},"metadata":{}}]},{"cell_type":"code","source":"train_targets = train_data.iloc[:, -5:]","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:17.598622Z","iopub.execute_input":"2024-08-31T12:26:17.599089Z","iopub.status.idle":"2024-08-31T12:26:17.606861Z","shell.execute_reply.started":"2024-08-31T12:26:17.599051Z","shell.execute_reply":"2024-08-31T12:26:17.605638Z"},"trusted":true},"execution_count":16,"outputs":[]},{"cell_type":"code","source":"train_targets.describe()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:19.999475Z","iopub.execute_input":"2024-08-31T12:26:20.000029Z","iopub.status.idle":"2024-08-31T12:26:20.072811Z","shell.execute_reply.started":"2024-08-31T12:26:19.999978Z","shell.execute_reply":"2024-08-31T12:26:20.071455Z"},"trusted":true},"execution_count":17,"outputs":[{"execution_count":17,"output_type":"execute_result","data":{"text/plain":"                 ttf        EP_disp  EP_disp_FUT_1  EP_disp_FUT_2  \\\ncount  158082.000000  158082.000000  158082.000000  158082.000000   \nmean        3.300500       4.597263       4.597195       4.597126   \nstd         1.896557       0.368915       0.369448       0.369981   \nmin         0.000000       3.983188      -1.000000      -1.000000   \n25%         1.657855       4.289584       4.289584       4.289583   \n50%         3.315709       4.602964       4.602964       4.602964   \n75%         4.941472       4.921575       4.921575       4.921575   \nmax         7.127265       5.249001       5.249001       5.249001   \n\n       EP_disp_FUT_3  \ncount  158082.000000  \nmean        4.597058  \nstd         0.370512  \nmin        -1.000000  \n25%         4.289582  \n50%         4.602964  \n75%         4.921575  \nmax         5.249001  ","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>ttf</th>\n      <th>EP_disp</th>\n      <th>EP_disp_FUT_1</th>\n      <th>EP_disp_FUT_2</th>\n      <th>EP_disp_FUT_3</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>count</th>\n      <td>158082.000000</td>\n      <td>158082.000000</td>\n      <td>158082.000000</td>\n      <td>158082.000000</td>\n      <td>158082.000000</td>\n    </tr>\n    <tr>\n      <th>mean</th>\n      <td>3.300500</td>\n      <td>4.597263</td>\n      <td>4.597195</td>\n      <td>4.597126</td>\n      <td>4.597058</td>\n    </tr>\n    <tr>\n      <th>std</th>\n      <td>1.896557</td>\n      <td>0.368915</td>\n      <td>0.369448</td>\n      <td>0.369981</td>\n      <td>0.370512</td>\n    </tr>\n    <tr>\n      <th>min</th>\n      <td>0.000000</td>\n      <td>3.983188</td>\n      <td>-1.000000</td>\n      <td>-1.000000</td>\n      <td>-1.000000</td>\n    </tr>\n    <tr>\n      <th>25%</th>\n      <td>1.657855</td>\n      <td>4.289584</td>\n      <td>4.289584</td>\n      <td>4.289583</td>\n      <td>4.289582</td>\n    </tr>\n    <tr>\n      <th>50%</th>\n      <td>3.315709</td>\n      <td>4.602964</td>\n      <td>4.602964</td>\n      <td>4.602964</td>\n      <td>4.602964</td>\n    </tr>\n    <tr>\n      <th>75%</th>\n      <td>4.941472</td>\n      <td>4.921575</td>\n      <td>4.921575</td>\n      <td>4.921575</td>\n      <td>4.921575</td>\n    </tr>\n    <tr>\n      <th>max</th>\n      <td>7.127265</td>\n      <td>5.249001</td>\n      <td>5.249001</td>\n      <td>5.249001</td>\n      <td>5.249001</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"test_data[['ae_1','ae_11','ae_111','ae_1111','ae_6000']].describe()","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:26:22.483677Z","iopub.execute_input":"2024-08-31T12:26:22.484322Z","iopub.status.idle":"2024-08-31T12:26:22.574136Z","shell.execute_reply.started":"2024-08-31T12:26:22.484273Z","shell.execute_reply":"2024-08-31T12:26:22.572708Z"},"trusted":true},"execution_count":18,"outputs":[{"execution_count":18,"output_type":"execute_result","data":{"text/plain":"                ae_1          ae_11         ae_111        ae_1111  \\\ncount  161278.000000  161278.000000  161278.000000  161278.000000   \nmean        0.811834       0.812107       0.778073       0.827453   \nstd         6.296276       5.355616       4.994158       4.993264   \nmin      -998.000000    -525.000000    -282.000000    -223.000000   \n25%        -2.000000      -2.000000      -2.000000      -2.000000   \n50%         1.000000       1.000000       1.000000       1.000000   \n75%         3.000000       4.000000       3.000000       3.000000   \nmax       553.000000     227.000000     355.000000     496.000000   \n\n             ae_6000  \ncount  161278.000000  \nmean        0.758430  \nstd         5.176501  \nmin      -562.000000  \n25%        -2.000000  \n50%         1.000000  \n75%         3.000000  \nmax       204.000000  ","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>ae_1</th>\n      <th>ae_11</th>\n      <th>ae_111</th>\n      <th>ae_1111</th>\n      <th>ae_6000</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>count</th>\n      <td>161278.000000</td>\n      <td>161278.000000</td>\n      <td>161278.000000</td>\n      <td>161278.000000</td>\n      <td>161278.000000</td>\n    </tr>\n    <tr>\n      <th>mean</th>\n      <td>0.811834</td>\n      <td>0.812107</td>\n      <td>0.778073</td>\n      <td>0.827453</td>\n      <td>0.758430</td>\n    </tr>\n    <tr>\n      <th>std</th>\n      <td>6.296276</td>\n      <td>5.355616</td>\n      <td>4.994158</td>\n      <td>4.993264</td>\n      <td>5.176501</td>\n    </tr>\n    <tr>\n      <th>min</th>\n      <td>-998.000000</td>\n      <td>-525.000000</td>\n      <td>-282.000000</td>\n      <td>-223.000000</td>\n      <td>-562.000000</td>\n    </tr>\n    <tr>\n      <th>25%</th>\n      <td>-2.000000</td>\n      <td>-2.000000</td>\n      <td>-2.000000</td>\n      <td>-2.000000</td>\n      <td>-2.000000</td>\n    </tr>\n    <tr>\n      <th>50%</th>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n      <td>1.000000</td>\n    </tr>\n    <tr>\n      <th>75%</th>\n      <td>3.000000</td>\n      <td>4.000000</td>\n      <td>3.000000</td>\n      <td>3.000000</td>\n      <td>3.000000</td>\n    </tr>\n    <tr>\n      <th>max</th>\n      <td>553.000000</td>\n      <td>227.000000</td>\n      <td>355.000000</td>\n      <td>496.000000</td>\n      <td>204.000000</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"# Bağımsız değişkenler (X) ve hedef değişkenler (y) belirleniyor\nX_train = train_data.iloc[:, :-5]  # İlk 6001 sütun\ny_train = train_targets  # Son 5 sütun (hedefler)\n\n# Test setinin bağımsız değişkenleri\nX_test = test_data\n","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:28:51.352869Z","iopub.execute_input":"2024-08-31T12:28:51.353321Z","iopub.status.idle":"2024-08-31T12:28:52.905964Z","shell.execute_reply.started":"2024-08-31T12:28:51.353283Z","shell.execute_reply":"2024-08-31T12:28:52.904573Z"},"trusted":true},"execution_count":20,"outputs":[]},{"cell_type":"code","source":"# XGBoost modeli için parametreler\nxgb_params = {\n    'objective': 'reg:squarederror',\n    'learning_rate': 0.05,\n    'max_depth': 8,\n    'subsample': 0.8,\n    'colsample_bytree': 0.8,\n    'n_estimators': 1000\n}\n\n# Modelin oluşturulması\nmodel = xgb.XGBRegressor(**xgb_params)\n","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:29:13.249271Z","iopub.execute_input":"2024-08-31T12:29:13.249736Z","iopub.status.idle":"2024-08-31T12:29:13.256674Z","shell.execute_reply.started":"2024-08-31T12:29:13.249702Z","shell.execute_reply":"2024-08-31T12:29:13.255299Z"},"trusted":true},"execution_count":22,"outputs":[]},{"cell_type":"code","source":"# XGBoost modeli için parametreler\nxgb_params = {\n    'objective': 'reg:squarederror',\n    'learning_rate': 0.05,\n    'max_depth': 6,  # Derinlik azaltıldı\n    'subsample': 0.8,\n    'colsample_bytree': 0.8,\n    'n_estimators': 500  # Ağaç sayısı azaltıldı\n}\n\n# Modelin oluşturulması\nmodel = xgb.XGBRegressor(**xgb_params)\n\n# Modeli eğitiyoruz\nmodel.fit(X_train, y_train['ttf'])\n","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:52:28.728922Z","iopub.execute_input":"2024-08-31T12:52:28.729415Z","iopub.status.idle":"2024-08-31T12:52:28.764274Z","shell.execute_reply.started":"2024-08-31T12:52:28.729375Z","shell.execute_reply":"2024-08-31T12:52:28.762408Z"},"trusted":true},"execution_count":3,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)","Cell \u001b[0;32mIn[3], line 12\u001b[0m\n\u001b[1;32m      2\u001b[0m xgb_params \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m      3\u001b[0m     \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mobjective\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mreg:squarederror\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m      4\u001b[0m     \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlearning_rate\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;241m0.05\u001b[39m,\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m      8\u001b[0m     \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mn_estimators\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;241m500\u001b[39m  \u001b[38;5;66;03m# Ağaç sayısı azaltıldı\u001b[39;00m\n\u001b[1;32m      9\u001b[0m }\n\u001b[1;32m     11\u001b[0m \u001b[38;5;66;03m# Modelin oluşturulması\u001b[39;00m\n\u001b[0;32m---> 12\u001b[0m model \u001b[38;5;241m=\u001b[39m \u001b[43mxgb\u001b[49m\u001b[38;5;241m.\u001b[39mXGBRegressor(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mxgb_params)\n\u001b[1;32m     14\u001b[0m \u001b[38;5;66;03m# Modeli eğitiyoruz\u001b[39;00m\n\u001b[1;32m     15\u001b[0m model\u001b[38;5;241m.\u001b[39mfit(X_train, y_train[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mttf\u001b[39m\u001b[38;5;124m'\u001b[39m])\n","\u001b[0;31mNameError\u001b[0m: name 'xgb' is not defined"],"ename":"NameError","evalue":"name 'xgb' is not defined","output_type":"error"}]},{"cell_type":"code","source":"import pandas as pd\nimport xgboost as xgb\nfrom sklearn.model_selection import train_test_split\n\n# Veri setinin yüklenmesi\n# Verilerin yüklendiği yer burası olmalı (CSV dosyası veya başka bir kaynak)\ndf = pd.read_csv(\"/kaggle/input/earthquake-prediction/train.csv\")\n\n# Burada veri kümesini yeniden yükleyip işleyebilirsin\n X = df.drop(columns=[\"ttf\"])  # Bağımsız değişkenler\n y = df[[\"ttf\"]]  # Hedef değişken\n\n# Veri setinin eğitim ve test olarak bölünmesi\n X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# XGBoost parametrelerinin ayarlanması\nxgb_params = {\n    'objective': 'reg:squarederror',\n    'learning_rate': 0.05,\n    'max_depth': 5,\n    'subsample': 0.7,\n    'colsample_bytree': 0.8,\n    'n_estimators': 500\n}\n\n# Modelin oluşturulması\nmodel = xgb.XGBRegressor(**xgb_params)\n\n# Eğer veri setini küçülttüysen aşağıdaki gibi kullanabilirsin:\n# X_train_small = X\n","metadata":{"execution":{"iopub.status.busy":"2024-08-31T13:09:13.26046Z","iopub.execute_input":"2024-08-31T13:09:13.261914Z","iopub.status.idle":"2024-08-31T13:09:13.271822Z","shell.execute_reply.started":"2024-08-31T13:09:13.261872Z","shell.execute_reply":"2024-08-31T13:09:13.270373Z"},"trusted":true},"execution_count":7,"outputs":[{"traceback":["\u001b[0;36m  Cell \u001b[0;32mIn[7], line 10\u001b[0;36m\u001b[0m\n\u001b[0;31m    X = df.drop(columns=[\"ttf\"])  # Bağımsız değişkenler\u001b[0m\n\u001b[0m    ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m unexpected indent\n"],"ename":"IndentationError","evalue":"unexpected indent (1435474265.py, line 10)","output_type":"error"}]},{"cell_type":"code","source":"\n# Burada veri kümesini yeniden yükleyip işleyebilirsin\nX = df.drop(columns=[\"ttf\"])  # Bağımsız değişkenler\ny = df[[\"ttf\"]]  # Hedef değişken\n\n# Veri setinin eğitim ve test olarak bölünmesi\n X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# XGBoost parametrelerinin ayarlanması\nxgb_params = {\n    'objective': 'reg:squarederror',\n    'learning_rate': 0.05,\n    'max_depth': 5,\n    'subsample': 0.7,\n    'colsample_bytree': 0.8,\n    'n_estimators': 500\n}\n\n# Modelin oluşturulması\nmodel = xgb.XGBRegressor(**xgb_params)\n\n# Eğer veri setini küçülttüysen aşağıdaki gibi kullanabilirsin:\n# X_train_small = X_train.sample(frac=0.3, random_state=42)\n# y_train_small = y_train.loc[X_train_small.index]\n\n# Modeli eğitiyoruz\nmodel.fit(X_train, y_train['ttf'])\n","metadata":{"execution":{"iopub.status.busy":"2024-08-31T13:10:44.358316Z","iopub.execute_input":"2024-08-31T13:10:44.359385Z","iopub.status.idle":"2024-08-31T13:10:44.369791Z","shell.execute_reply.started":"2024-08-31T13:10:44.359343Z","shell.execute_reply":"2024-08-31T13:10:44.366955Z"},"trusted":true},"execution_count":9,"outputs":[{"traceback":["\u001b[0;36m  Cell \u001b[0;32mIn[9], line 6\u001b[0;36m\u001b[0m\n\u001b[0;31m    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\u001b[0m\n\u001b[0m    ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m unexpected indent\n"],"ename":"IndentationError","evalue":"unexpected indent (2129094197.py, line 6)","output_type":"error"}]},{"cell_type":"code","source":"# Test verisi üzerinde tahmin yapıyoruz\ny_pred = model.predict(X_test)\n\n# Tahmin edilen 'ttf' değerlerini sample_submission_long dosyasına ekleme\nsample_submission_long['ttf'] = y_pred\n","metadata":{"execution":{"iopub.status.busy":"2024-08-31T12:49:08.013334Z","iopub.status.idle":"2024-08-31T12:49:08.013791Z","shell.execute_reply.started":"2024-08-31T12:49:08.013582Z","shell.execute_reply":"2024-08-31T12:49:08.013603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Sonuçların CSV dosyasına kaydedilmesi\nsample_submission_long.to_csv('/kaggle/working/sample_submission.csv', index=False)\n","metadata":{},"execution_count":null,"outputs":[]}]}