{"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":"import numpy as np\nimport pandas as pd\n\nfrom sklearn import model_selection","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-09-07T13:16:31.085664Z","iopub.execute_input":"2021-09-07T13:16:31.086241Z","iopub.status.idle":"2021-09-07T13:16:32.030770Z","shell.execute_reply.started":"2021-09-07T13:16:31.086204Z","shell.execute_reply":"2021-09-07T13:16:32.029916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data = pd.read_csv(\"../input/g2net-gravitational-wave-detection/training_labels.csv\")","metadata":{"execution":{"iopub.status.busy":"2021-09-07T13:16:32.032414Z","iopub.execute_input":"2021-09-07T13:16:32.033035Z","iopub.status.idle":"2021-09-07T13:16:32.452269Z","shell.execute_reply.started":"2021-09-07T13:16:32.032976Z","shell.execute_reply":"2021-09-07T13:16:32.451427Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.head()","metadata":{"execution":{"iopub.status.busy":"2021-09-07T13:16:32.453772Z","iopub.execute_input":"2021-09-07T13:16:32.454194Z","iopub.status.idle":"2021-09-07T13:16:32.463994Z","shell.execute_reply.started":"2021-09-07T13:16:32.454163Z","shell.execute_reply":"2021-09-07T13:16:32.462837Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data[\"kfold\"] = -1\n\nkf = model_selection.StratifiedKFold(n_splits=5, shuffle=True, random_state=42)\n\nfor f, (t_, v_) in enumerate(kf.split(X=data, y=data.target.values)):\n    data.loc[v_, 'kfold'] = f","metadata":{"execution":{"iopub.status.busy":"2021-09-07T13:16:32.465440Z","iopub.execute_input":"2021-09-07T13:16:32.465736Z","iopub.status.idle":"2021-09-07T13:16:32.683404Z","shell.execute_reply.started":"2021-09-07T13:16:32.465708Z","shell.execute_reply":"2021-09-07T13:16:32.682225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.to_csv(\"train_folds.csv\", index=False)","metadata":{},"execution_count":null,"outputs":[]}]}