{"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":41880,"databundleVersionId":5677426,"sourceType":"competition"},{"sourceId":7025678,"sourceType":"datasetVersion","datasetId":4040466}],"dockerImageVersionId":30626,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install -U /kaggle/input/lightautoml-python-3-11/lightautoml-0.3.9b1-py3-none-any.whl >> None","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:21:26.871431Z","iopub.execute_input":"2023-12-26T23:21:26.871989Z","iopub.status.idle":"2023-12-26T23:21:42.282801Z","shell.execute_reply.started":"2023-12-26T23:21:26.871919Z","shell.execute_reply":"2023-12-26T23:21:42.281399Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install fasteda >> None","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:21:42.286017Z","iopub.execute_input":"2023-12-26T23:21:42.286424Z","iopub.status.idle":"2023-12-26T23:21:57.074794Z","shell.execute_reply.started":"2023-12-26T23:21:42.286388Z","shell.execute_reply":"2023-12-26T23:21:57.073323Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport time\n\n# Installed libraries\nimport numpy as np\nimport pandas as pd\nfrom sklearn.metrics import roc_auc_score, log_loss\nfrom sklearn.model_selection import train_test_split\nimport torch\n\n# Imports from our package\nfrom lightautoml.automl.base import AutoML\nfrom lightautoml.automl.blend import WeightedBlender\nfrom lightautoml.ml_algo.boost_lgbm import BoostLGBM\nfrom lightautoml.ml_algo.linear_sklearn import LinearLBFGS\nfrom lightautoml.ml_algo.tuning.optuna import OptunaTuner\nfrom lightautoml.pipelines.features.lgb_pipeline import LGBSimpleFeatures, LGBAdvancedPipeline\nfrom lightautoml.pipelines.features.linear_pipeline import LinearFeatures\nfrom lightautoml.pipelines.ml.base import MLPipeline\nfrom lightautoml.pipelines.selection.importance_based import ModelBasedImportanceEstimator, ImportanceCutoffSelector\nfrom lightautoml.reader.base import PandasToPandasReader\nfrom lightautoml.tasks import Task\nfrom lightautoml.utils.timer import PipelineTimer\nfrom sklearn.preprocessing import LabelEncoder\nfrom lightautoml.automl.presets.tabular_presets import TabularAutoML\nfrom sklearn.metrics import f1_score\nimport matplotlib.pyplot as plt\nfrom fasteda import fast_eda","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-12-26T23:21:57.076656Z","iopub.execute_input":"2023-12-26T23:21:57.077095Z","iopub.status.idle":"2023-12-26T23:22:41.400532Z","shell.execute_reply.started":"2023-12-26T23:21:57.077057Z","shell.execute_reply":"2023-12-26T23:22:41.399480Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Import data","metadata":{}},{"cell_type":"markdown","source":"## Import tdcsfog","metadata":{}},{"cell_type":"code","source":"path = '/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/tdcsfog/'\ntdcsfog = pd.concat([pd.read_csv(os.path.join(root, name)) for root, _, files in os.walk(path) for name in files], axis=0)\n\ntdcsfog.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:22:41.402052Z","iopub.execute_input":"2023-12-26T23:22:41.403087Z","iopub.status.idle":"2023-12-26T23:22:53.631941Z","shell.execute_reply.started":"2023-12-26T23:22:41.403050Z","shell.execute_reply":"2023-12-26T23:22:53.631099Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tdcsfog.info()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:22:53.634768Z","iopub.execute_input":"2023-12-26T23:22:53.635351Z","iopub.status.idle":"2023-12-26T23:22:53.649084Z","shell.execute_reply.started":"2023-12-26T23:22:53.635317Z","shell.execute_reply":"2023-12-26T23:22:53.647990Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tdcsfog.describe()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:22:53.650419Z","iopub.execute_input":"2023-12-26T23:22:53.650774Z","iopub.status.idle":"2023-12-26T23:22:55.415762Z","shell.execute_reply.started":"2023-12-26T23:22:53.650743Z","shell.execute_reply":"2023-12-26T23:22:55.414678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Import defog","metadata":{}},{"cell_type":"code","source":"path = '/kaggle/input/tlvmc-parkinsons-freezing-gait-prediction/train/defog'\ndefog = pd.concat([pd.read_csv(os.path.join(root, name)) for root, _, files in os.walk(path) for name in files], axis=0)\n\ndefog.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:22:55.417417Z","iopub.execute_input":"2023-12-26T23:22:55.417878Z","iopub.status.idle":"2023-12-26T23:23:13.884271Z","shell.execute_reply.started":"2023-12-26T23:22:55.417837Z","shell.execute_reply":"2023-12-26T23:23:13.883166Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog.info()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:13.885561Z","iopub.execute_input":"2023-12-26T23:23:13.885981Z","iopub.status.idle":"2023-12-26T23:23:13.897990Z","shell.execute_reply.started":"2023-12-26T23:23:13.885934Z","shell.execute_reply":"2023-12-26T23:23:13.897056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog.describe()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:13.899538Z","iopub.execute_input":"2023-12-26T23:23:13.900231Z","iopub.status.idle":"2023-12-26T23:23:16.838941Z","shell.execute_reply.started":"2023-12-26T23:23:13.900196Z","shell.execute_reply":"2023-12-26T23:23:16.837743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"defog_data_valid = defog.loc[ \\\n                        (defog.Valid == True) & (defog.Task == True)].copy()\n\ndefog_data_valid.reset_index(drop=True, inplace=True)\ndefog_data_valid.drop(['Valid', 'Task'], axis=1, inplace=True)\ndefog_data_valid.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:16.840465Z","iopub.execute_input":"2023-12-26T23:23:16.841714Z","iopub.status.idle":"2023-12-26T23:23:17.479296Z","shell.execute_reply.started":"2023-12-26T23:23:16.841666Z","shell.execute_reply":"2023-12-26T23:23:17.478030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"join defog and tdcsfog","metadata":{}},{"cell_type":"code","source":"full_data = pd.concat([tdcsfog, defog_data_valid])\nfull_data","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:17.480983Z","iopub.execute_input":"2023-12-26T23:23:17.482016Z","iopub.status.idle":"2023-12-26T23:23:17.809250Z","shell.execute_reply.started":"2023-12-26T23:23:17.481948Z","shell.execute_reply":"2023-12-26T23:23:17.807911Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# EDA full data","metadata":{}},{"cell_type":"code","source":"condlist = [\n    full_data['StartHesitation'] == 1,\n    full_data['Turn'] == 1,\n    full_data['Walking'] == 1\n]\n\nchoicelist = ['StartHesitation', 'Turn', 'Walking']\nfull_data['TARGET'] = np.select(condlist=condlist, choicelist=choicelist, default='Normal')\n\ntarget_counts = full_data['TARGET'].value_counts().to_frame()\ntarget_counts","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:17.811018Z","iopub.execute_input":"2023-12-26T23:23:17.812229Z","iopub.status.idle":"2023-12-26T23:23:23.467329Z","shell.execute_reply.started":"2023-12-26T23:23:17.812188Z","shell.execute_reply":"2023-12-26T23:23:23.466037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def count_activity(df):   \n    plt.title('Count for Each Activity')\n    plt.xlabel('Event')\n    plt.ylabel('Counts')\n\n\n    y_rows = ['StartHesitation', 'Turn', 'Walking']\n\n    counts = df[y_rows].sum()\n    normal_count = len(df.loc[df['TARGET'] == 'Normal'])\n    counts['Normal'] = normal_count\n\n    percentages = (counts / counts.sum()) * 100\n\n    y_rows_plt = ['StartHesitation', 'Turn', 'Walking', 'Normal']\n\n    bars = plt.bar(y_rows_plt, counts)\n\n    for bar, percentage in zip(bars, percentages):\n        plt.text(bar.get_x() + bar.get_width() / 2 - 0.15, bar.get_height() + 0.5,\n                 f'{percentage:.2f}%', ha='center', va='bottom', color='black')\n\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:23.469082Z","iopub.execute_input":"2023-12-26T23:23:23.469549Z","iopub.status.idle":"2023-12-26T23:23:23.480946Z","shell.execute_reply.started":"2023-12-26T23:23:23.469506Z","shell.execute_reply":"2023-12-26T23:23:23.479750Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"count_activity(full_data)","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:23.485104Z","iopub.execute_input":"2023-12-26T23:23:23.485544Z","iopub.status.idle":"2023-12-26T23:23:26.713006Z","shell.execute_reply.started":"2023-12-26T23:23:23.485506Z","shell.execute_reply":"2023-12-26T23:23:26.711720Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from fasteda import fast_eda\nfast_eda(full_data)","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:23:26.714440Z","iopub.execute_input":"2023-12-26T23:23:26.714918Z","iopub.status.idle":"2023-12-26T23:47:14.219704Z","shell.execute_reply.started":"2023-12-26T23:23:26.714874Z","shell.execute_reply":"2023-12-26T23:47:14.218596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"balance data","metadata":{}},{"cell_type":"code","source":"le = LabelEncoder()\nfull_data['TARGET'] = le.fit_transform(full_data['TARGET'])","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:48:38.612841Z","iopub.execute_input":"2023-12-26T23:48:38.613326Z","iopub.status.idle":"2023-12-26T23:48:42.337096Z","shell.execute_reply.started":"2023-12-26T23:48:38.613290Z","shell.execute_reply":"2023-12-26T23:48:42.335779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_balanced = full_data.groupby('TARGET', group_keys=False).apply(lambda x: x.sample(min(len(x), full_data['TARGET'].value_counts().min())))\ndf_balanced.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:48:46.547082Z","iopub.execute_input":"2023-12-26T23:48:46.548580Z","iopub.status.idle":"2023-12-26T23:48:48.814548Z","shell.execute_reply.started":"2023-12-26T23:48:46.548532Z","shell.execute_reply":"2023-12-26T23:48:48.813077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"target_counts_balanced = df_balanced['TARGET'].value_counts().to_frame()\ntarget_counts_balanced","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:50:42.465670Z","iopub.execute_input":"2023-12-26T23:50:42.466219Z","iopub.status.idle":"2023-12-26T23:50:42.491137Z","shell.execute_reply.started":"2023-12-26T23:50:42.466179Z","shell.execute_reply":"2023-12-26T23:50:42.489891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_balanced.drop(['Time', 'Turn', 'Walking', 'StartHesitation'], axis=1, inplace=True)","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:51:42.491853Z","iopub.execute_input":"2023-12-26T23:51:42.493065Z","iopub.status.idle":"2023-12-26T23:51:42.509217Z","shell.execute_reply.started":"2023-12-26T23:51:42.493009Z","shell.execute_reply":"2023-12-26T23:51:42.507833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  Data splitting for train-test","metadata":{}},{"cell_type":"code","source":"N_THREADS = 4\nN_FOLDS = 5 \nRANDOM_STATE = 42 \nTEST_SIZE = 0.3 \nTIMEOUT = 600*4\nTARGET_NAME = 'TARGET' ","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:51:46.234140Z","iopub.execute_input":"2023-12-26T23:51:46.234601Z","iopub.status.idle":"2023-12-26T23:51:46.240777Z","shell.execute_reply.started":"2023-12-26T23:51:46.234564Z","shell.execute_reply":"2023-12-26T23:51:46.239615Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\n\ntrain_data, test_data = train_test_split(df_balanced, \n                                         test_size=TEST_SIZE, \n                                         stratify=df_balanced[TARGET_NAME], \n                                         random_state=RANDOM_STATE)\nprint('Data splitted. Parts sizes: train_data = {}, test_data = {}'\n              .format(train_data.shape, test_data.shape))","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:52:12.613821Z","iopub.execute_input":"2023-12-26T23:52:12.615357Z","iopub.status.idle":"2023-12-26T23:52:13.248531Z","shell.execute_reply.started":"2023-12-26T23:52:12.615301Z","shell.execute_reply":"2023-12-26T23:52:13.247352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-26T23:52:16.471026Z","iopub.execute_input":"2023-12-26T23:52:16.472477Z","iopub.status.idle":"2023-12-26T23:52:16.490036Z","shell.execute_reply.started":"2023-12-26T23:52:16.472407Z","shell.execute_reply":"2023-12-26T23:52:16.488391Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":" # AutoML","metadata":{}},{"cell_type":"markdown","source":"## First experiment","metadata":{}},{"cell_type":"code","source":"task1 = Task(\n    'multiclass', \n    metric='accuracy')","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:15:38.496886Z","iopub.execute_input":"2023-12-27T00:15:38.497549Z","iopub.status.idle":"2023-12-27T00:15:38.508303Z","shell.execute_reply.started":"2023-12-27T00:15:38.497502Z","shell.execute_reply":"2023-12-27T00:15:38.506520Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"roles1 = {\n    'target': 'TARGET',\n}","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:17:12.863482Z","iopub.execute_input":"2023-12-27T00:17:12.863998Z","iopub.status.idle":"2023-12-27T00:17:12.869671Z","shell.execute_reply.started":"2023-12-27T00:17:12.863944Z","shell.execute_reply":"2023-12-27T00:17:12.868377Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"automl1 = TabularAutoML(\n    task = task1,\n    timeout = TIMEOUT,\n    cpu_limit = N_THREADS,\n    reader_params = {'n_jobs': N_THREADS, 'cv': N_FOLDS, 'random_state': RANDOM_STATE},\n    general_params={'use_algos': [['lgb']]}\n)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:17:18.240654Z","iopub.execute_input":"2023-12-27T00:17:18.241216Z","iopub.status.idle":"2023-12-27T00:17:18.300386Z","shell.execute_reply.started":"2023-12-27T00:17:18.241173Z","shell.execute_reply":"2023-12-27T00:17:18.298817Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"out_of_fold_predictions1 = automl1.fit_predict(train_data, roles = roles1, verbose = 1)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:17:19.289918Z","iopub.execute_input":"2023-12-27T00:17:19.290419Z","iopub.status.idle":"2023-12-27T00:22:01.022039Z","shell.execute_reply.started":"2023-12-27T00:17:19.290376Z","shell.execute_reply":"2023-12-27T00:22:01.020655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_predictions1 = automl1.predict(test_data)\nprint(f'Prediction for test_data:\\n{test_predictions1}\\nShape = {test_predictions1.shape}')","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:30:27.202863Z","iopub.execute_input":"2023-12-27T00:30:27.203406Z","iopub.status.idle":"2023-12-27T00:30:45.011682Z","shell.execute_reply.started":"2023-12-27T00:30:27.203368Z","shell.execute_reply":"2023-12-27T00:30:45.009739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_preds_test1 = pd.DataFrame(test_predictions1.data, columns=[0, 1, 2, 3])\ny_preds_test_labels1 = y_preds_test1.idxmax(axis=1)\ny_preds_test_labels1.tail(15)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:30:48.295660Z","iopub.execute_input":"2023-12-27T00:30:48.296112Z","iopub.status.idle":"2023-12-27T00:30:50.786230Z","shell.execute_reply.started":"2023-12-27T00:30:48.296074Z","shell.execute_reply":"2023-12-27T00:30:50.785092Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_preds_test1 = pd.DataFrame(out_of_fold_predictions1.data, columns=[0, 1, 2, 3])\nx_preds_test_labels1 = x_preds_test1.idxmax(axis=1)\nx_preds_test_labels1.tail(15)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:31:30.463889Z","iopub.execute_input":"2023-12-27T00:31:30.464466Z","iopub.status.idle":"2023-12-27T00:31:36.246830Z","shell.execute_reply.started":"2023-12-27T00:31:30.464425Z","shell.execute_reply":"2023-12-27T00:31:36.245461Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import accuracy_score\nprint('OOF score:', accuracy_score(train_data['TARGET'], x_preds_test_labels1))\nprint('HOLDOUT score:', accuracy_score(test_data['TARGET'], y_preds_test_labels1))","metadata":{"execution":{"iopub.status.busy":"2023-12-27T00:33:25.829973Z","iopub.execute_input":"2023-12-27T00:33:25.830401Z","iopub.status.idle":"2023-12-27T00:33:25.911665Z","shell.execute_reply.started":"2023-12-27T00:33:25.830369Z","shell.execute_reply":"2023-12-27T00:33:25.910010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Second experiment","metadata":{}},{"cell_type":"code","source":"task2 = Task(\n    'multiclass', \n    metric='accuracy')","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:26:08.036754Z","iopub.execute_input":"2023-12-27T01:26:08.037400Z","iopub.status.idle":"2023-12-27T01:26:08.046813Z","shell.execute_reply.started":"2023-12-27T01:26:08.037360Z","shell.execute_reply":"2023-12-27T01:26:08.045808Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"roles2 = {\n    'target': 'TARGET',\n}","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:26:12.012498Z","iopub.execute_input":"2023-12-27T01:26:12.013723Z","iopub.status.idle":"2023-12-27T01:26:12.019864Z","shell.execute_reply.started":"2023-12-27T01:26:12.013630Z","shell.execute_reply":"2023-12-27T01:26:12.018334Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"automl2 = TabularAutoML(\n    task = task2,\n    timeout = 300,\n    cpu_limit = N_THREADS,\n    reader_params = {'n_jobs': N_THREADS, 'cv': N_FOLDS, 'random_state': RANDOM_STATE},\n    general_params={'use_algos': [['linear_l2', 'lgb', 'cb']]}\n)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:26:14.696639Z","iopub.execute_input":"2023-12-27T01:26:14.697217Z","iopub.status.idle":"2023-12-27T01:26:14.754455Z","shell.execute_reply.started":"2023-12-27T01:26:14.697174Z","shell.execute_reply":"2023-12-27T01:26:14.752868Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"out_of_fold_predictions2 = automl2.fit_predict(train_data, roles = roles2, verbose = 1)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:26:18.035676Z","iopub.execute_input":"2023-12-27T01:26:18.036236Z","iopub.status.idle":"2023-12-27T01:32:42.199063Z","shell.execute_reply.started":"2023-12-27T01:26:18.036195Z","shell.execute_reply":"2023-12-27T01:32:42.197387Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_predictions2 = automl2.predict(test_data)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:34:11.194728Z","iopub.execute_input":"2023-12-27T01:34:11.196284Z","iopub.status.idle":"2023-12-27T01:34:18.779963Z","shell.execute_reply.started":"2023-12-27T01:34:11.196215Z","shell.execute_reply":"2023-12-27T01:34:18.778599Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_preds_test2 = pd.DataFrame(out_of_fold_predictions2.data, columns=[0, 1, 2, 3])\nx_preds_test_labels2 = x_preds_test2.idxmax(axis=1)\nx_preds_test_labels2.tail(15)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:35:04.130973Z","iopub.execute_input":"2023-12-27T01:35:04.131505Z","iopub.status.idle":"2023-12-27T01:35:09.898664Z","shell.execute_reply.started":"2023-12-27T01:35:04.131468Z","shell.execute_reply":"2023-12-27T01:35:09.897289Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_preds_test2 = pd.DataFrame(test_predictions2.data, columns=[0, 1, 2, 3])\ny_preds_test_labels2 = y_preds_test2.idxmax(axis=1)\ny_preds_test_labels2.tail(15)","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:34:37.947343Z","iopub.execute_input":"2023-12-27T01:34:37.947858Z","iopub.status.idle":"2023-12-27T01:34:40.441261Z","shell.execute_reply.started":"2023-12-27T01:34:37.947823Z","shell.execute_reply":"2023-12-27T01:34:40.440047Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('OOF score:', accuracy_score(train_data['TARGET'], x_preds_test_labels2))\nprint('HOLDOUT score:', accuracy_score(test_data['TARGET'], y_preds_test_labels2))","metadata":{"execution":{"iopub.status.busy":"2023-12-27T01:35:29.434457Z","iopub.execute_input":"2023-12-27T01:35:29.436104Z","iopub.status.idle":"2023-12-27T01:35:29.528878Z","shell.execute_reply.started":"2023-12-27T01:35:29.436043Z","shell.execute_reply":"2023-12-27T01:35:29.527409Z"},"trusted":true},"execution_count":null,"outputs":[]}]}