{"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\nimport h5py\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-17T20:58:51.317026Z","iopub.execute_input":"2023-10-17T20:58:51.317403Z","iopub.status.idle":"2023-10-17T20:58:51.896049Z","shell.execute_reply.started":"2023-10-17T20:58:51.317369Z","shell.execute_reply":"2023-10-17T20:58:51.894926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%capture\n!pip install pycaret[full]","metadata":{"execution":{"iopub.status.busy":"2023-10-17T20:58:51.990769Z","iopub.execute_input":"2023-10-17T20:58:51.991301Z","iopub.status.idle":"2023-10-17T21:00:27.108839Z","shell.execute_reply.started":"2023-10-17T20:58:51.991260Z","shell.execute_reply":"2023-10-17T21:00:27.107248Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with h5py.File('/kaggle/input/g2net-dataset-catch22-features/transformed_data.h5', 'r') as f:\n    features = np.array(f['catch22_features'])\n","metadata":{"execution":{"iopub.status.busy":"2023-10-17T06:18:54.607279Z","iopub.execute_input":"2023-10-17T06:18:54.607719Z","iopub.status.idle":"2023-10-17T06:18:57.856320Z","shell.execute_reply.started":"2023-10-17T06:18:54.607675Z","shell.execute_reply":"2023-10-17T06:18:57.855088Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels_df = pd.read_csv('/kaggle/input/g2net-gravitational-wave-detection/training_labels.csv')\ntarget = labels_df['target']","metadata":{"execution":{"iopub.status.busy":"2023-10-17T06:30:42.458252Z","iopub.execute_input":"2023-10-17T06:30:42.458681Z","iopub.status.idle":"2023-10-17T06:30:42.897405Z","shell.execute_reply.started":"2023-10-17T06:30:42.458628Z","shell.execute_reply":"2023-10-17T06:30:42.896189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from pycaret.classification import *\ns = setup(features, target = target,\n         session_id = 123,\n         normalize = False,\n         use_gpu = False,\n         #log_experiment = 'wandb',\n         experiment_name = 'g2net_train',\n         #profile = True,\n         train_size = 0.8,\n         fold_strategy = 'kfold',\n         #numeric_features = ['climateregions__climateregion','month','unique_loc']\n         remove_multicollinearity = False,\n         pca = False,\n         )","metadata":{"execution":{"iopub.status.busy":"2023-10-17T06:30:44.047947Z","iopub.execute_input":"2023-10-17T06:30:44.048322Z","iopub.status.idle":"2023-10-17T06:30:54.297094Z","shell.execute_reply.started":"2023-10-17T06:30:44.048295Z","shell.execute_reply":"2023-10-17T06:30:54.295995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"models()","metadata":{"execution":{"iopub.status.busy":"2023-10-17T06:32:22.547030Z","iopub.execute_input":"2023-10-17T06:32:22.547521Z","iopub.status.idle":"2023-10-17T06:32:22.764611Z","shell.execute_reply.started":"2023-10-17T06:32:22.547489Z","shell.execute_reply":"2023-10-17T06:32:22.763818Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"compare_models()","metadata":{"execution":{"iopub.status.busy":"2023-10-17T06:33:27.670397Z","iopub.execute_input":"2023-10-17T06:33:27.670918Z","iopub.status.idle":"2023-10-17T09:56:15.330511Z","shell.execute_reply.started":"2023-10-17T06:33:27.670884Z","shell.execute_reply":"2023-10-17T09:56:15.329543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"g2net_catboost = create_model('catboost')","metadata":{"execution":{"iopub.status.busy":"2023-10-17T10:07:16.762516Z","iopub.execute_input":"2023-10-17T10:07:16.763524Z","iopub.status.idle":"2023-10-17T10:26:48.588169Z","shell.execute_reply.started":"2023-10-17T10:07:16.763459Z","shell.execute_reply":"2023-10-17T10:26:48.586802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"g2net_lightgbm = create_model('lightgbm')","metadata":{"execution":{"iopub.status.busy":"2023-10-17T10:32:28.924265Z","iopub.execute_input":"2023-10-17T10:32:28.924864Z","iopub.status.idle":"2023-10-17T10:36:25.642567Z","shell.execute_reply.started":"2023-10-17T10:32:28.924819Z","shell.execute_reply":"2023-10-17T10:36:25.640955Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tune_lightgbm = tune_model(g2net_lightgbm,search_library = 'optuna')","metadata":{"execution":{"iopub.status.idle":"2023-10-17T11:30:00.474050Z","shell.execute_reply.started":"2023-10-17T10:38:56.790637Z","shell.execute_reply":"2023-10-17T11:30:00.472440Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tune_catboost = tune_model(g2net_catboost)","metadata":{"execution":{"iopub.status.busy":"2023-10-17T11:38:32.554698Z","iopub.execute_input":"2023-10-17T11:38:32.555146Z","iopub.status.idle":"2023-10-17T12:18:49.839834Z","shell.execute_reply.started":"2023-10-17T11:38:32.555116Z","shell.execute_reply":"2023-10-17T12:18:49.838359Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nblender = blend_models([g2net_catboost, g2net_lightgbm])","metadata":{"execution":{"iopub.status.busy":"2023-10-17T12:30:31.095782Z","iopub.execute_input":"2023-10-17T12:30:31.096371Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_model(tune_lightgbm, plot = 'auc')","metadata":{"execution":{"iopub.status.busy":"2023-10-17T11:36:44.373080Z","iopub.execute_input":"2023-10-17T11:36:44.373540Z","iopub.status.idle":"2023-10-17T11:36:49.699689Z","shell.execute_reply.started":"2023-10-17T11:36:44.373513Z","shell.execute_reply":"2023-10-17T11:36:49.698548Z"},"trusted":true},"execution_count":null,"outputs":[]}]}