{"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)\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":"2023-10-19T18:06:13.401936Z","iopub.execute_input":"2023-10-19T18:06:13.402499Z","iopub.status.idle":"2023-10-19T18:06:13.887120Z","shell.execute_reply.started":"2023-10-19T18:06:13.402461Z","shell.execute_reply":"2023-10-19T18:06:13.885999Z"},"trusted":true},"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":"2023-10-19T18:23:39.090849Z","iopub.execute_input":"2023-10-19T18:23:39.091283Z","iopub.status.idle":"2023-10-19T18:23:39.494257Z","shell.execute_reply.started":"2023-10-19T18:23:39.091253Z","shell.execute_reply":"2023-10-19T18:23:39.492901Z"},"trusted":true},"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":"2023-10-19T18:28:18.806412Z","iopub.execute_input":"2023-10-19T18:28:18.807413Z","iopub.status.idle":"2023-10-19T18:34:56.739080Z","shell.execute_reply.started":"2023-10-19T18:28:18.807370Z","shell.execute_reply":"2023-10-19T18:34:56.737777Z"},"trusted":true},"execution_count":null,"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":"2023-10-19T18:38:13.973095Z","iopub.execute_input":"2023-10-19T18:38:13.973552Z","iopub.status.idle":"2023-10-19T18:38:14.784590Z","shell.execute_reply.started":"2023-10-19T18:38:13.973519Z","shell.execute_reply":"2023-10-19T18:38:14.783170Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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":"2023-10-19T18:39:24.663845Z","iopub.execute_input":"2023-10-19T18:39:24.664307Z","iopub.status.idle":"2023-10-19T18:40:12.972307Z","shell.execute_reply.started":"2023-10-19T18:39:24.664275Z","shell.execute_reply":"2023-10-19T18:40:12.971221Z"},"trusted":true},"execution_count":null,"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_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.dtypes","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:49:24.030161Z","iopub.execute_input":"2023-10-19T18:49:24.030572Z","iopub.status.idle":"2023-10-19T18:49:24.041112Z","shell.execute_reply.started":"2023-10-19T18:49:24.030537Z","shell.execute_reply":"2023-10-19T18:49:24.039878Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.shape, test_data.shape, ","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:34:56.742063Z","iopub.execute_input":"2023-10-19T18:34:56.742553Z","iopub.status.idle":"2023-10-19T18:34:56.751098Z","shell.execute_reply.started":"2023-10-19T18:34:56.742514Z","shell.execute_reply":"2023-10-19T18:34:56.749778Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:34:56.753489Z","iopub.execute_input":"2023-10-19T18:34:56.754077Z","iopub.status.idle":"2023-10-19T18:34:56.783635Z","shell.execute_reply.started":"2023-10-19T18:34:56.754037Z","shell.execute_reply":"2023-10-19T18:34:56.782710Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.tail()","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:34:56.785850Z","iopub.execute_input":"2023-10-19T18:34:56.787067Z","iopub.status.idle":"2023-10-19T18:34:56.807065Z","shell.execute_reply.started":"2023-10-19T18:34:56.787017Z","shell.execute_reply":"2023-10-19T18:34:56.805795Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:34:56.808841Z","iopub.execute_input":"2023-10-19T18:34:56.809395Z","iopub.status.idle":"2023-10-19T18:34:56.837234Z","shell.execute_reply.started":"2023-10-19T18:34:56.809367Z","shell.execute_reply":"2023-10-19T18:34:56.836036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data.tail()","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:34:56.838662Z","iopub.execute_input":"2023-10-19T18:34:56.839060Z","iopub.status.idle":"2023-10-19T18:34:56.861635Z","shell.execute_reply.started":"2023-10-19T18:34:56.839031Z","shell.execute_reply":"2023-10-19T18:34:56.860776Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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":"2023-10-19T18:40:34.507991Z","iopub.execute_input":"2023-10-19T18:40:34.508428Z","iopub.status.idle":"2023-10-19T18:40:34.708296Z","shell.execute_reply.started":"2023-10-19T18:40:34.508398Z","shell.execute_reply":"2023-10-19T18:40:34.706955Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission_long.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:40:34.914719Z","iopub.execute_input":"2023-10-19T18:40:34.915118Z","iopub.status.idle":"2023-10-19T18:40:34.923981Z","shell.execute_reply.started":"2023-10-19T18:40:34.915089Z","shell.execute_reply":"2023-10-19T18:40:34.922647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_targets = train_data.iloc[:, -5:]","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:40:38.675557Z","iopub.execute_input":"2023-10-19T18:40:38.676126Z","iopub.status.idle":"2023-10-19T18:40:38.687051Z","shell.execute_reply.started":"2023-10-19T18:40:38.676089Z","shell.execute_reply":"2023-10-19T18:40:38.684776Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_targets.describe()","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:40:39.018626Z","iopub.execute_input":"2023-10-19T18:40:39.019038Z","iopub.status.idle":"2023-10-19T18:40:39.079935Z","shell.execute_reply.started":"2023-10-19T18:40:39.019007Z","shell.execute_reply":"2023-10-19T18:40:39.078773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data[['ae_1','ae_11','ae_111','ae_1111','ae_6000']].describe()","metadata":{"execution":{"iopub.status.busy":"2023-10-19T18:41:53.079403Z","iopub.execute_input":"2023-10-19T18:41:53.079871Z","iopub.status.idle":"2023-10-19T18:41:53.147713Z","shell.execute_reply.started":"2023-10-19T18:41:53.079838Z","shell.execute_reply":"2023-10-19T18:41:53.146517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}