{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":50160,"databundleVersionId":7602123,"sourceType":"competition"}],"dockerImageVersionId":30646,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"Resources\n- <https://www.kaggle.com/code/jetakow/home-credit-2024-starter-notebook>","metadata":{}},{"cell_type":"markdown","source":"Basic ideas were taken from the above starter notebook,\nbut adapted to my preference.\n- Begin with fewer features\n- Begin with default parameters\n- Be lazy (use of Polars LazyFrame)\n- Scoring function returns all factors ($\\mathrm{gini}$, $a$, and $\\mathrm{std}(\\mathrm{residuals})$)\n- Train-test split by `WEEK_NUM`","metadata":{}},{"cell_type":"markdown","source":"Overview\n- Train-test split: `WEEK_NUM < 40` and `WEEK_NUM >= 40`\n- Features used\n  - `A` and `M` groups in `static_0`\n- Model: LightGBM with the default parameters","metadata":{}},{"cell_type":"markdown","source":"# Setup","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport polars as pl\nimport json","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:24.632626Z","iopub.execute_input":"2024-02-13T23:53:24.633042Z","iopub.status.idle":"2024-02-13T23:53:24.932198Z","shell.execute_reply.started":"2024-02-13T23:53:24.633001Z","shell.execute_reply":"2024-02-13T23:53:24.931155Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Load dataset","metadata":{}},{"cell_type":"code","source":"df_feature_definitions = pl.read_csv('/kaggle/input/home-credit-credit-risk-model-stability/feature_definitions.csv')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:24.990660Z","iopub.execute_input":"2024-02-13T23:53:24.991001Z","iopub.status.idle":"2024-02-13T23:53:25.196154Z","shell.execute_reply.started":"2024-02-13T23:53:24.990973Z","shell.execute_reply":"2024-02-13T23:53:25.194883Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_base = pl.read_parquet('/kaggle/input/home-credit-credit-risk-model-stability/parquet_files/train/train_base.parquet')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:25.197314Z","iopub.execute_input":"2024-02-13T23:53:25.197646Z","iopub.status.idle":"2024-02-13T23:53:25.375134Z","shell.execute_reply.started":"2024-02-13T23:53:25.197617Z","shell.execute_reply":"2024-02-13T23:53:25.374214Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train_all = df_train_base.drop('target', 'WEEK_NUM')\ny_train_all = df_train_base['target']\nw_train_all = df_train_base['WEEK_NUM']","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:25.407285Z","iopub.execute_input":"2024-02-13T23:53:25.407592Z","iopub.status.idle":"2024-02-13T23:53:25.421556Z","shell.execute_reply.started":"2024-02-13T23:53:25.407568Z","shell.execute_reply":"2024-02-13T23:53:25.420433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"For other tables,\nwe fix dtypes at read time.\nFrom the data description, we know that `A` group is of dtype `float`\nand `M` group is of dtype `Categorical`.","metadata":{}},{"cell_type":"code","source":"def scan_data_and_fix_dtype(parquet_file):\n    return pl.scan_parquet(parquet_file).with_columns(\n        pl.col(r'^.*A$').cast(pl.Float64),\n        pl.col(r'^.*M$').cast(pl.Categorical),\n    )","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:25.934787Z","iopub.execute_input":"2024-02-13T23:53:25.935120Z","iopub.status.idle":"2024-02-13T23:53:25.940719Z","shell.execute_reply.started":"2024-02-13T23:53:25.935093Z","shell.execute_reply":"2024-02-13T23:53:25.939645Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Train-test split","metadata":{}},{"cell_type":"code","source":"def custom_split(X, y, w, split_at):\n    b = w < split_at\n    train_idx, = np.nonzero(b)\n    test_idx, = np.nonzero(~b)\n    return (\n        X[:, train_idx], X[:, test_idx],\n        y[train_idx], y[test_idx],\n        w[train_idx], w[test_idx],\n    )","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:26.425198Z","iopub.execute_input":"2024-02-13T23:53:26.425545Z","iopub.status.idle":"2024-02-13T23:53:26.431421Z","shell.execute_reply.started":"2024-02-13T23:53:26.425517Z","shell.execute_reply":"2024-02-13T23:53:26.430153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train, X_test, y_train, y_test, w_train, w_test = custom_split(\n    X_train_all, y_train_all, w_train_all, 40,\n)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:26.598767Z","iopub.execute_input":"2024-02-13T23:53:26.599082Z","iopub.status.idle":"2024-02-13T23:53:27.045063Z","shell.execute_reply.started":"2024-02-13T23:53:26.599058Z","shell.execute_reply":"2024-02-13T23:53:27.043800Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# static_0 features","metadata":{}},{"cell_type":"code","source":"df_train_static_0 = scan_data_and_fix_dtype('/kaggle/input/home-credit-credit-risk-model-stability/parquet_files/train/train_static_0_*.parquet')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:27.046883Z","iopub.execute_input":"2024-02-13T23:53:27.047329Z","iopub.status.idle":"2024-02-13T23:53:27.073864Z","shell.execute_reply.started":"2024-02-13T23:53:27.047301Z","shell.execute_reply":"2024-02-13T23:53:27.072884Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def join_static_0_features(X, df_static_0):\n    X = X.lazy()\n    a = df_static_0.select('case_id', pl.col(r'^.*(?:A|M)$'))\n    return X.join(a, on = 'case_id', how = 'left')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:27.191093Z","iopub.execute_input":"2024-02-13T23:53:27.191394Z","iopub.status.idle":"2024-02-13T23:53:27.196151Z","shell.execute_reply.started":"2024-02-13T23:53:27.191370Z","shell.execute_reply":"2024-02-13T23:53:27.195247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(join_static_0_features(X_train, df_train_static_0).schema)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:27.484537Z","iopub.execute_input":"2024-02-13T23:53:27.484895Z","iopub.status.idle":"2024-02-13T23:53:27.496712Z","shell.execute_reply.started":"2024-02-13T23:53:27.484840Z","shell.execute_reply":"2024-02-13T23:53:27.495902Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# All features","metadata":{}},{"cell_type":"code","source":"def drop_unwanted_features(X):\n    return X.drop('case_id', 'date_decision', 'MONTH')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:27.935405Z","iopub.execute_input":"2024-02-13T23:53:27.935793Z","iopub.status.idle":"2024-02-13T23:53:27.941012Z","shell.execute_reply.started":"2024-02-13T23:53:27.935763Z","shell.execute_reply":"2024-02-13T23:53:27.939789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def generate_all_features(X, df_static_0):\n    X = X.lazy()\n    X = join_static_0_features(X, df_static_0)\n    X = drop_unwanted_features(X)\n    return X","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:28.135413Z","iopub.execute_input":"2024-02-13T23:53:28.136065Z","iopub.status.idle":"2024-02-13T23:53:28.142628Z","shell.execute_reply.started":"2024-02-13T23:53:28.136032Z","shell.execute_reply":"2024-02-13T23:53:28.141553Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(generate_all_features(X_train, df_train_static_0).schema)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:28.344028Z","iopub.execute_input":"2024-02-13T23:53:28.344330Z","iopub.status.idle":"2024-02-13T23:53:28.352208Z","shell.execute_reply.started":"2024-02-13T23:53:28.344304Z","shell.execute_reply":"2024-02-13T23:53:28.351321Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train_feats = generate_all_features(\n    X_train,\n    df_train_static_0,\n).collect(streaming = True).to_pandas()","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:28.934918Z","iopub.execute_input":"2024-02-13T23:53:28.935750Z","iopub.status.idle":"2024-02-13T23:53:31.205054Z","shell.execute_reply.started":"2024-02-13T23:53:28.935721Z","shell.execute_reply":"2024-02-13T23:53:31.203995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(X_train_feats.info())","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:31.206815Z","iopub.execute_input":"2024-02-13T23:53:31.207176Z","iopub.status.idle":"2024-02-13T23:53:31.261454Z","shell.execute_reply.started":"2024-02-13T23:53:31.207150Z","shell.execute_reply":"2024-02-13T23:53:31.260489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(X_train_feats)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:31.262712Z","iopub.execute_input":"2024-02-13T23:53:31.263034Z","iopub.status.idle":"2024-02-13T23:53:31.385766Z","shell.execute_reply.started":"2024-02-13T23:53:31.263006Z","shell.execute_reply":"2024-02-13T23:53:31.384828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test_feats = generate_all_features(\n    X_test,\n    df_train_static_0,\n).collect(streaming = True).to_pandas()","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:31.387696Z","iopub.execute_input":"2024-02-13T23:53:31.388001Z","iopub.status.idle":"2024-02-13T23:53:32.865231Z","shell.execute_reply.started":"2024-02-13T23:53:31.387978Z","shell.execute_reply":"2024-02-13T23:53:32.864498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Train LightGBM","metadata":{}},{"cell_type":"code","source":"import lightgbm as lgbm","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:32.866433Z","iopub.execute_input":"2024-02-13T23:53:32.866757Z","iopub.status.idle":"2024-02-13T23:53:34.471050Z","shell.execute_reply.started":"2024-02-13T23:53:32.866738Z","shell.execute_reply":"2024-02-13T23:53:34.469999Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_train = lgbm.Dataset(X_train_feats, label = y_train.to_pandas())","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:34.472353Z","iopub.execute_input":"2024-02-13T23:53:34.472708Z","iopub.status.idle":"2024-02-13T23:53:34.477783Z","shell.execute_reply.started":"2024-02-13T23:53:34.472679Z","shell.execute_reply":"2024-02-13T23:53:34.476909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"params = {\n    'seed': 0,\n    'objective': 'binary',\n    'verbosity': -1,\n}","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:34.479616Z","iopub.execute_input":"2024-02-13T23:53:34.479975Z","iopub.status.idle":"2024-02-13T23:53:34.490545Z","shell.execute_reply.started":"2024-02-13T23:53:34.479916Z","shell.execute_reply":"2024-02-13T23:53:34.489261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"booster = lgbm.train(\n    params,\n    ds_train,\n)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:34.492164Z","iopub.execute_input":"2024-02-13T23:53:34.492513Z","iopub.status.idle":"2024-02-13T23:53:44.450110Z","shell.execute_reply.started":"2024-02-13T23:53:34.492486Z","shell.execute_reply":"2024-02-13T23:53:44.448772Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"booster.save_model('lgbm_eval.txt');","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:44.451225Z","iopub.execute_input":"2024-02-13T23:53:44.451473Z","iopub.status.idle":"2024-02-13T23:53:44.464288Z","shell.execute_reply.started":"2024-02-13T23:53:44.451453Z","shell.execute_reply":"2024-02-13T23:53:44.463107Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Evaluation","metadata":{}},{"cell_type":"code","source":"from sklearn.metrics import roc_auc_score","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:53:44.465426Z","iopub.execute_input":"2024-02-13T23:53:44.465708Z","iopub.status.idle":"2024-02-13T23:53:44.491007Z","shell.execute_reply.started":"2024-02-13T23:53:44.465683Z","shell.execute_reply":"2024-02-13T23:53:44.489683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def gini_stability(y_true, y_pred, w, w_fallingrate = 88.0, w_resstd = -0.5):\n    X = pl.DataFrame({\n        'true_target': y_true,\n        'predicted_target': y_pred,\n        'WEEK_NUM': w,\n    })\n    z = np.array([\n        [x['WEEK_NUM'][0], roc_auc_score(x['true_target'], x['predicted_target'])]\n        for _, x in X.group_by(['WEEK_NUM'])\n    ], dtype = np.float64)\n    weekly_auc = z[:, 1]\n    weekly_gini = 2 * weekly_auc - 1\n    x = z[:, 0]\n    y = weekly_gini\n    a, b = np.polyfit(x, y, 1)\n    y_hat = a * x + b\n    residuals = y - y_hat\n    res_std = np.std(residuals)\n    avg_gini = np.mean(weekly_gini)\n    return {\n        'score': avg_gini + w_fallingrate * min(0, a) + w_resstd * res_std,\n        'gini': avg_gini,\n        'a': a,\n        'std(residuals)': res_std,\n    }","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:56:12.605309Z","iopub.execute_input":"2024-02-13T23:56:12.605656Z","iopub.status.idle":"2024-02-13T23:56:12.613808Z","shell.execute_reply.started":"2024-02-13T23:56:12.605630Z","shell.execute_reply":"2024-02-13T23:56:12.612515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_score = gini_stability(y_test, booster.predict(X_test_feats), w_test)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:56:14.604477Z","iopub.execute_input":"2024-02-13T23:56:14.604774Z","iopub.status.idle":"2024-02-13T23:56:16.582553Z","shell.execute_reply.started":"2024-02-13T23:56:14.604752Z","shell.execute_reply":"2024-02-13T23:56:16.581342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(test_score)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T23:56:18.186674Z","iopub.execute_input":"2024-02-13T23:56:18.187078Z","iopub.status.idle":"2024-02-13T23:56:18.192969Z","shell.execute_reply.started":"2024-02-13T23:56:18.187049Z","shell.execute_reply":"2024-02-13T23:56:18.191569Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with open('score.json', 'w') as f:\n    json.dump(test_score, f)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T08:21:12.753162Z","iopub.execute_input":"2024-02-13T08:21:12.753636Z","iopub.status.idle":"2024-02-13T08:21:12.759692Z","shell.execute_reply.started":"2024-02-13T08:21:12.753599Z","shell.execute_reply":"2024-02-13T08:21:12.758315Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_feature_importance = pl.DataFrame({\n    'Variable': booster.feature_name(),\n    'gain': booster.feature_importance('gain'),\n    'split': booster.feature_importance('split'),\n}).join(df_feature_definitions, on = 'Variable', how = 'left')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T08:21:13.552659Z","iopub.execute_input":"2024-02-13T08:21:13.553081Z","iopub.status.idle":"2024-02-13T08:21:13.562188Z","shell.execute_reply.started":"2024-02-13T08:21:13.553049Z","shell.execute_reply":"2024-02-13T08:21:13.560930Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"with pl.Config() as cfg:\n    cfg.set_tbl_rows(-1)\n    cfg.set_fmt_str_lengths(300)\n    display(df_feature_importance.sort('gain', descending = True))","metadata":{"execution":{"iopub.status.busy":"2024-02-13T08:21:14.743217Z","iopub.execute_input":"2024-02-13T08:21:14.743940Z","iopub.status.idle":"2024-02-13T08:21:14.761725Z","shell.execute_reply.started":"2024-02-13T08:21:14.743904Z","shell.execute_reply":"2024-02-13T08:21:14.760333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"lgbm.plot_importance(booster, importance_type = 'gain',\n                     figsize = (8, X_train_feats.shape[1] // 4));","metadata":{"execution":{"iopub.status.busy":"2024-02-13T08:22:48.065834Z","iopub.execute_input":"2024-02-13T08:22:48.066330Z","iopub.status.idle":"2024-02-13T08:22:48.930705Z","shell.execute_reply.started":"2024-02-13T08:22:48.066293Z","shell.execute_reply":"2024-02-13T08:22:48.929293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Submission","metadata":{}},{"cell_type":"code","source":"X_train_all_feats = generate_all_features(\n    X_train_all,\n    df_train_static_0,\n).collect(streaming = True).to_pandas()","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:04:45.967436Z","iopub.execute_input":"2024-02-13T07:04:45.967930Z","iopub.status.idle":"2024-02-13T07:04:47.952025Z","shell.execute_reply.started":"2024-02-13T07:04:45.967839Z","shell.execute_reply":"2024-02-13T07:04:47.950655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_train_all = lgbm.Dataset(X_train_all_feats, label = y_train_all.to_pandas())","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:05:29.716646Z","iopub.execute_input":"2024-02-13T07:05:29.717039Z","iopub.status.idle":"2024-02-13T07:05:29.723718Z","shell.execute_reply.started":"2024-02-13T07:05:29.717008Z","shell.execute_reply":"2024-02-13T07:05:29.722167Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"final_booster = lgbm.train(\n    params, ds_train_all,\n)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:05:38.085136Z","iopub.execute_input":"2024-02-13T07:05:38.085576Z","iopub.status.idle":"2024-02-13T07:05:56.936880Z","shell.execute_reply.started":"2024-02-13T07:05:38.085516Z","shell.execute_reply":"2024-02-13T07:05:56.935695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"final_booster.save_model('lgbm_submission.txt');","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:06:09.301423Z","iopub.execute_input":"2024-02-13T07:06:09.301876Z","iopub.status.idle":"2024-02-13T07:06:09.314129Z","shell.execute_reply.started":"2024-02-13T07:06:09.301843Z","shell.execute_reply":"2024-02-13T07:06:09.312846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = pl.read_parquet('/kaggle/input/home-credit-credit-risk-model-stability/parquet_files/test/test_base.parquet')\ndf_test = df_test.drop('WEEK_NUM')\ndf_test_static_0 = scan_data_and_fix_dtype('/kaggle/input/home-credit-credit-risk-model-stability/parquet_files/test/test_static_0_*.parquet')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:10:20.816385Z","iopub.execute_input":"2024-02-13T07:10:20.816843Z","iopub.status.idle":"2024-02-13T07:10:20.829224Z","shell.execute_reply.started":"2024-02-13T07:10:20.816806Z","shell.execute_reply":"2024-02-13T07:10:20.828048Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test_feats = generate_all_features(\n    df_test,\n    df_test_static_0,\n).collect(streaming = True).to_pandas()","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:10:21.980123Z","iopub.execute_input":"2024-02-13T07:10:21.980807Z","iopub.status.idle":"2024-02-13T07:10:22.002362Z","shell.execute_reply.started":"2024-02-13T07:10:21.980771Z","shell.execute_reply":"2024-02-13T07:10:22.001107Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(df_test_feats)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:10:29.791600Z","iopub.execute_input":"2024-02-13T07:10:29.792009Z","iopub.status.idle":"2024-02-13T07:10:29.827800Z","shell.execute_reply.started":"2024-02-13T07:10:29.791978Z","shell.execute_reply":"2024-02-13T07:10:29.826666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_submission = pl.DataFrame({\n    'case_id': df_test['case_id'],\n    'score': final_booster.predict(df_test_feats),\n})","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:10:36.038086Z","iopub.execute_input":"2024-02-13T07:10:36.038482Z","iopub.status.idle":"2024-02-13T07:10:36.050489Z","shell.execute_reply.started":"2024-02-13T07:10:36.038451Z","shell.execute_reply":"2024-02-13T07:10:36.049016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display(df_submission)","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:10:42.376779Z","iopub.execute_input":"2024-02-13T07:10:42.377186Z","iopub.status.idle":"2024-02-13T07:10:42.393516Z","shell.execute_reply.started":"2024-02-13T07:10:42.377154Z","shell.execute_reply":"2024-02-13T07:10:42.392056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_submission.write_csv('submission.csv')","metadata":{"execution":{"iopub.status.busy":"2024-02-13T07:10:55.500126Z","iopub.execute_input":"2024-02-13T07:10:55.500525Z","iopub.status.idle":"2024-02-13T07:10:55.511752Z","shell.execute_reply.started":"2024-02-13T07:10:55.500494Z","shell.execute_reply":"2024-02-13T07:10:55.510582Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}