{"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":7921029,"sourceType":"competition"}],"dockerImageVersionId":30698,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport gc\nfrom glob import glob\nfrom pathlib import Path\nfrom datetime import datetime\n\nimport numpy as np\nimport pandas as pd\nimport polars as pl\n\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nfrom sklearn.model_selection import StratifiedGroupKFold\nfrom sklearn.base import BaseEstimator, ClassifierMixin\n\nimport lightgbm as lgb\n\nimport warnings\nwarnings.simplefilter(action='ignore', category=FutureWarning)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-04-24T06:06:57.979259Z","iopub.execute_input":"2024-04-24T06:06:57.979659Z","iopub.status.idle":"2024-04-24T06:07:03.253345Z","shell.execute_reply.started":"2024-04-24T06:06:57.979627Z","shell.execute_reply":"2024-04-24T06:07:03.252019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class VotingModel(BaseEstimator, ClassifierMixin):\n    def __init__(self, estimators):\n        super().__init__()\n        self.estimators = estimators\n        \n    def fit(self, X, y=None):\n        return self\n    \n    def predict(self, X):\n        y_preds = [estimator.predict(X) for estimator in self.estimators]\n        return np.mean(y_preds, axis=0)\n    \n    def predict_proba(self, X):\n        y_preds = [estimator.predict_proba(X) for estimator in self.estimators]\n        return np.mean(y_preds, axis=0)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:28.420619Z","iopub.execute_input":"2024-04-24T06:07:28.422251Z","iopub.status.idle":"2024-04-24T06:07:28.431867Z","shell.execute_reply.started":"2024-04-24T06:07:28.422195Z","shell.execute_reply":"2024-04-24T06:07:28.430623Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Pipeline","metadata":{}},{"cell_type":"code","source":"class Pipeline:\n    @staticmethod\n    def set_table_dtypes(df):\n        for col in df.columns:\n            if col in [\"case_id\", \"WEEK_NUM\", \"num_group1\", \"num_group2\"]:\n                df = df.with_columns(pl.col(col).cast(pl.Int32))\n            elif col in [\"date_decision\"]:\n                df = df.with_columns(pl.col(col).cast(pl.Date))\n            elif col[-1] in (\"P\", \"A\"):\n                df = df.with_columns(pl.col(col).cast(pl.Float64))\n            elif col[-1] in (\"M\",):\n                df = df.with_columns(pl.col(col).cast(pl.String))\n            elif col[-1] in (\"D\",):\n                df = df.with_columns(pl.col(col).cast(pl.Date))            \n\n        return df\n    \n    @staticmethod\n    def handle_dates(df):\n        for col in df.columns:\n            if col[-1] in (\"D\",):\n                df = df.with_columns(pl.col(col) - pl.col(\"date_decision\"))\n                df = df.with_columns(pl.col(col).dt.total_days())\n                df = df.with_columns(pl.col(col).cast(pl.Float32))\n                \n        df = df.drop(\"date_decision\", \"MONTH\")\n\n        return df\n    \n    @staticmethod\n    def filter_cols(df):\n        for col in df.columns:\n            if col not in [\"target\", \"case_id\", \"WEEK_NUM\"]:\n                isnull = df[col].is_null().mean()\n\n                if isnull > 0.95:\n                    df = df.drop(col)\n\n        for col in df.columns:\n            if (col not in [\"target\", \"case_id\", \"WEEK_NUM\"]) & (df[col].dtype == pl.String):\n                freq = df[col].n_unique()\n\n                if (freq == 1) | (freq > 200):\n                    df = df.drop(col)\n\n        return df","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:31.633685Z","iopub.execute_input":"2024-04-24T06:07:31.634305Z","iopub.status.idle":"2024-04-24T06:07:31.651049Z","shell.execute_reply.started":"2024-04-24T06:07:31.634262Z","shell.execute_reply":"2024-04-24T06:07:31.649626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class Aggregator:\n    @staticmethod\n    def num_expr(df):\n        cols = [col for col in df.columns if col[-1] in (\"P\", \"A\")]\n\n        expr_max = [pl.max(col).alias(f\"max_{col}\") for col in cols]\n\n        return expr_max\n\n    @staticmethod\n    def date_expr(df):\n        cols = [col for col in df.columns if col[-1] in (\"D\",)]\n\n        expr_max = [pl.max(col).alias(f\"max_{col}\") for col in cols]\n\n        return expr_max\n\n    @staticmethod\n    def str_expr(df):\n        cols = [col for col in df.columns if col[-1] in (\"M\",)]\n        \n        expr_max = [pl.max(col).alias(f\"max_{col}\") for col in cols]\n\n        return expr_max\n\n    @staticmethod\n    def other_expr(df):\n        cols = [col for col in df.columns if col[-1] in (\"T\", \"L\")]\n        \n        expr_max = [pl.max(col).alias(f\"max_{col}\") for col in cols]\n\n        return expr_max\n    \n    @staticmethod\n    def count_expr(df):\n        cols = [col for col in df.columns if \"num_group\" in col]\n\n        expr_max = [pl.max(col).alias(f\"max_{col}\") for col in cols]\n\n        return expr_max\n\n    @staticmethod\n    def get_exprs(df):\n        exprs = Aggregator.num_expr(df) + \\\n                Aggregator.date_expr(df) + \\\n                Aggregator.str_expr(df) + \\\n                Aggregator.other_expr(df) + \\\n                Aggregator.count_expr(df)\n\n        return exprs","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:32.572880Z","iopub.execute_input":"2024-04-24T06:07:32.573314Z","iopub.status.idle":"2024-04-24T06:07:32.588315Z","shell.execute_reply.started":"2024-04-24T06:07:32.573282Z","shell.execute_reply":"2024-04-24T06:07:32.586911Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Merge Tables","metadata":{}},{"cell_type":"code","source":"def read_file(path, depth=None):\n    df = pl.read_csv(path)\n    df = df.pipe(Pipeline.set_table_dtypes)\n    \n    if depth in [1, 2]:\n        df = df.group_by(\"case_id\").agg(Aggregator.get_exprs(df))\n    \n    return df\n\ndef read_files(regex_path, depth=None):\n    chunks = []\n    for path in glob(str(regex_path)):\n        df = pl.read_csv(path)\n        df = df.pipe(Pipeline.set_table_dtypes)\n        \n        if depth in [1, 2]:\n            df = df.group_by(\"case_id\").agg(Aggregator.get_exprs(df))\n        \n        chunks.append(df)\n        \n    df = pl.concat(chunks, how=\"vertical_relaxed\")\n    df = df.unique(subset=[\"case_id\"])\n    \n    return df","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:36.141434Z","iopub.execute_input":"2024-04-24T06:07:36.141894Z","iopub.status.idle":"2024-04-24T06:07:36.151586Z","shell.execute_reply.started":"2024-04-24T06:07:36.141855Z","shell.execute_reply":"2024-04-24T06:07:36.150247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def feature_eng(df_base, depth_0, depth_1, depth_2):\n    df_base = (\n        df_base\n        .with_columns(\n            month_decision = pl.col(\"date_decision\").dt.month(),\n            weekday_decision = pl.col(\"date_decision\").dt.weekday(),\n        )\n    )\n        \n    for i, df in enumerate(depth_0 + depth_1 + depth_2):\n        df_base = df_base.join(df, how=\"left\", on=\"case_id\", suffix=f\"_{i}\")\n        \n    df_base = df_base.pipe(Pipeline.handle_dates)\n    \n    return df_base","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:37.846878Z","iopub.execute_input":"2024-04-24T06:07:37.847346Z","iopub.status.idle":"2024-04-24T06:07:37.855904Z","shell.execute_reply.started":"2024-04-24T06:07:37.847306Z","shell.execute_reply":"2024-04-24T06:07:37.854584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def to_pandas(df_data, cat_cols=None):\n    df_data = df_data.to_pandas()\n    \n    if cat_cols is None:\n        cat_cols = list(df_data.select_dtypes(\"object\").columns)\n    \n    df_data[cat_cols] = df_data[cat_cols].astype(\"category\")\n    \n    return df_data, cat_cols","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:39.515934Z","iopub.execute_input":"2024-04-24T06:07:39.516380Z","iopub.status.idle":"2024-04-24T06:07:39.523367Z","shell.execute_reply.started":"2024-04-24T06:07:39.516346Z","shell.execute_reply":"2024-04-24T06:07:39.522031Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ROOT = Path(\"/kaggle/input/home-credit-credit-risk-model-stability\")\nTRAIN_DIR = ROOT / \"csv_files\" / \"train\"  # Adjust the directory name as needed\nTEST_DIR = ROOT / \"csv_files\" / \"test\"    # Adjust the directory name as needed\n","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:41.501053Z","iopub.execute_input":"2024-04-24T06:07:41.501485Z","iopub.status.idle":"2024-04-24T06:07:41.508032Z","shell.execute_reply.started":"2024-04-24T06:07:41.501452Z","shell.execute_reply":"2024-04-24T06:07:41.506554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_store = {\n    \"df_base\": read_file(TRAIN_DIR / \"train_base.csv\"),\n    \"depth_0\": [\n        read_file(TRAIN_DIR / \"train_static_cb_0.csv\"),\n        read_files(TRAIN_DIR / \"train_static_0_*.csv\"),\n    ],\n    \"depth_1\": [\n        read_files(TRAIN_DIR / \"train_applprev_1_*.csv\", 1),\n        read_file(TRAIN_DIR / \"train_tax_registry_a_1.csv\", 1),\n        read_file(TRAIN_DIR / \"train_tax_registry_b_1.csv\", 1),\n        read_file(TRAIN_DIR / \"train_tax_registry_c_1.csv\", 1),\n        read_files(TRAIN_DIR / \"train_credit_bureau_a_1_*.csv\", 1),\n        read_file(TRAIN_DIR / \"train_credit_bureau_b_1.csv\", 1),\n        read_file(TRAIN_DIR / \"train_other_1.csv\", 1),\n        read_file(TRAIN_DIR / \"train_person_1.csv\", 1),\n        read_file(TRAIN_DIR / \"train_deposit_1.csv\", 1),\n        read_file(TRAIN_DIR / \"train_debitcard_1.csv\", 1),\n    ],\n    \"depth_2\": [\n        read_file(TRAIN_DIR / \"train_credit_bureau_b_2.csv\", 2),\n        read_files(TRAIN_DIR / \"train_credit_bureau_a_2_*.csv\", 2),\n    ]\n}\n","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:07:42.942727Z","iopub.execute_input":"2024-04-24T06:07:42.943171Z","iopub.status.idle":"2024-04-24T06:11:57.221129Z","shell.execute_reply.started":"2024-04-24T06:07:42.943138Z","shell.execute_reply":"2024-04-24T06:11:57.220064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train = feature_eng(**data_store)\n\nprint(\"train data shape:\\t\", df_train.shape)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:14:47.268462Z","iopub.execute_input":"2024-04-24T06:14:47.269034Z","iopub.status.idle":"2024-04-24T06:15:00.208630Z","shell.execute_reply.started":"2024-04-24T06:14:47.268990Z","shell.execute_reply":"2024-04-24T06:15:00.207201Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Label encoding","metadata":{}},{"cell_type":"code","source":"from imblearn.over_sampling import SMOTE\nfrom sklearn.preprocessing import LabelEncoder\n\nprint(type(df_train))\ndf_train_pandas = df_train.to_pandas()\nprint(type(df_train_pandas))\n\nnumer = []\ncateg = []\n\nfor col in df_train_pandas.columns:\n    if df_train_pandas[col].dtype == 'object':\n        categ.append(col)\n    else:\n        numer.append(col)\n        \n# label_encoders = {}\n# for col in categ:\n#     label_encoders[col] = LabelEncoder()\n#     df_train_pandas[col] = label_encoders[col].fit_transform(df_train_pandas[col])\n\nlabel_encoder = LabelEncoder()\nfor column in categ:\n        df_train_pandas[column] = label_encoder.fit_transform(df_train_pandas[column])","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:04.067212Z","iopub.execute_input":"2024-04-24T06:15:04.068245Z","iopub.status.idle":"2024-04-24T06:15:04.074294Z","shell.execute_reply.started":"2024-04-24T06:15:04.068198Z","shell.execute_reply":"2024-04-24T06:15:04.072743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Balance the data(undersampling or oversampling)","metadata":{}},{"cell_type":"code","source":"from imblearn.under_sampling import RandomUnderSampler\nx = df_train_pandas.drop('target', axis=1)\ny = df_train_pandas['target']\nprint(\"-------------------\",df_train_pandas['target'].value_counts())\n#oversample = SMOTE()\nundersample = RandomUnderSampler()\nX, Y = undersample.fit_resample(x, y)\ndf_train_pandas = pd.concat([X, pd.Series(Y, name='target')], axis=1)\nprint(\"after--------------\", df_train_pandas['target'].value_counts())\n\ndf_train = pl.from_pandas(df_train_pandas)\nprint(type(df_train))","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:05.637874Z","iopub.execute_input":"2024-04-24T06:15:05.638316Z","iopub.status.idle":"2024-04-24T06:15:05.644146Z","shell.execute_reply.started":"2024-04-24T06:15:05.638273Z","shell.execute_reply":"2024-04-24T06:15:05.643149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_store = {\n    \"df_base\": read_file(TEST_DIR / \"test_base.csv\"),\n    \"depth_0\": [\n        read_file(TEST_DIR / \"test_static_cb_0.csv\"),\n        read_files(TEST_DIR / \"test_static_0_*.csv\"),\n    ],\n    \"depth_1\": [\n        read_files(TEST_DIR / \"test_applprev_1_*.csv\", 1),\n        read_file(TEST_DIR / \"test_tax_registry_a_1.csv\", 1),\n        read_file(TEST_DIR / \"test_tax_registry_b_1.csv\", 1),\n        read_file(TEST_DIR / \"test_tax_registry_c_1.csv\", 1),\n        read_files(TEST_DIR / \"test_credit_bureau_a_1_*.csv\", 1),\n        read_file(TEST_DIR / \"test_credit_bureau_b_1.csv\", 1),\n        read_file(TEST_DIR / \"test_other_1.csv\", 1),\n        read_file(TEST_DIR / \"test_person_1.csv\", 1),\n        read_file(TEST_DIR / \"test_deposit_1.csv\", 1),\n        read_file(TEST_DIR / \"test_debitcard_1.csv\", 1),\n    ],\n    \"depth_2\": [\n        read_file(TEST_DIR / \"test_credit_bureau_b_2.csv\", 2),\n        read_files(TEST_DIR / \"test_credit_bureau_a_2_*.csv\", 2),\n    ]\n}\n","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:07.724980Z","iopub.execute_input":"2024-04-24T06:15:07.725461Z","iopub.status.idle":"2024-04-24T06:15:08.508193Z","shell.execute_reply.started":"2024-04-24T06:15:07.725421Z","shell.execute_reply":"2024-04-24T06:15:08.506520Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = feature_eng(**data_store)\n\nprint(\"test data shape:\\t\", df_test.shape)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:10.554365Z","iopub.execute_input":"2024-04-24T06:15:10.555057Z","iopub.status.idle":"2024-04-24T06:15:10.614830Z","shell.execute_reply.started":"2024-04-24T06:15:10.555017Z","shell.execute_reply":"2024-04-24T06:15:10.613201Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train = df_train.pipe(Pipeline.filter_cols)\ndf_test = df_test.select([col for col in df_train.columns if col != \"target\"])\n\nprint(\"train data shape:\\t\", df_train.shape)\nprint(\"test data shape:\\t\", df_test.shape)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:12.822136Z","iopub.execute_input":"2024-04-24T06:15:12.822570Z","iopub.status.idle":"2024-04-24T06:15:16.565043Z","shell.execute_reply.started":"2024-04-24T06:15:12.822530Z","shell.execute_reply":"2024-04-24T06:15:16.563626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train, cat_cols = to_pandas(df_train)\ndf_test, cat_cols = to_pandas(df_test, cat_cols)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:18.141283Z","iopub.execute_input":"2024-04-24T06:15:18.141767Z","iopub.status.idle":"2024-04-24T06:15:47.631361Z","shell.execute_reply.started":"2024-04-24T06:15:18.141727Z","shell.execute_reply":"2024-04-24T06:15:47.630029Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del data_store\n\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:55.944045Z","iopub.execute_input":"2024-04-24T06:15:55.944455Z","iopub.status.idle":"2024-04-24T06:15:56.095233Z","shell.execute_reply.started":"2024-04-24T06:15:55.944424Z","shell.execute_reply":"2024-04-24T06:15:56.093754Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Train is duplicated:\\t\", df_train[\"case_id\"].duplicated().any())\nprint(\"Train Week Range:\\t\", (df_train[\"WEEK_NUM\"].min(), df_train[\"WEEK_NUM\"].max()))\n\nprint()\n\nprint(\"Test is duplicated:\\t\", df_test[\"case_id\"].duplicated().any())\nprint(\"Test Week Range:\\t\", (df_test[\"WEEK_NUM\"].min(), df_test[\"WEEK_NUM\"].max()))","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:15:58.983643Z","iopub.execute_input":"2024-04-24T06:15:58.984117Z","iopub.status.idle":"2024-04-24T06:15:59.020646Z","shell.execute_reply.started":"2024-04-24T06:15:58.984078Z","shell.execute_reply":"2024-04-24T06:15:59.019444Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Lightbgm model training","metadata":{}},{"cell_type":"code","source":"X = df_train.drop(columns=[\"target\", \"case_id\", \"WEEK_NUM\"])\ny = df_train[\"target\"]\nweeks = df_train[\"WEEK_NUM\"]\n\ncv = StratifiedGroupKFold(n_splits=5, shuffle=False)\n\nparams = {\n    \"boosting_type\": \"gbdt\",\n    \"objective\": \"binary\",\n    \"metric\": \"auc\",\n    \"max_depth\": 8,\n    \"learning_rate\": 0.05,\n    \"n_estimators\": 1000,\n    \"colsample_bytree\": 0.8, \n    \"colsample_bynode\": 0.8,\n    \"verbose\": -1,\n    \"random_state\": 42\n}\n\nfitted_models = []\n\nfor idx_train, idx_valid in cv.split(X, y, groups=weeks):\n    X_train, y_train = X.iloc[idx_train], y.iloc[idx_train]\n    X_valid, y_valid = X.iloc[idx_valid], y.iloc[idx_valid]\n\n    model = lgb.LGBMClassifier(**params)\n    model.fit(\n        X_train, y_train,\n        eval_set=[(X_valid, y_valid)],\n        callbacks=[lgb.log_evaluation(10), lgb.early_stopping(5)]\n    )\n  \n    fitted_models.append(model)\n\nmodel = VotingModel(fitted_models)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T06:16:01.794731Z","iopub.execute_input":"2024-04-24T06:16:01.795180Z","iopub.status.idle":"2024-04-24T07:55:15.648596Z","shell.execute_reply.started":"2024-04-24T06:16:01.795146Z","shell.execute_reply":"2024-04-24T07:55:15.644583Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"numer = []\ncateg = []\n\nfor col in df_test.columns:\n    if df_test[col].dtype == 'object':\n        categ.append(col)\n    else:\n        numer.append(col)\n\nfrom sklearn.preprocessing import LabelEncoder\n\nlabel_encoder = LabelEncoder()\nfor col in categ:\n    df_test[col] = label_encoder.fit_transform(df_test[col])\n        \nX_test = df_test.drop(columns=[\"WEEK_NUM\"])\nX_test = X_test.set_index(\"case_id\")\n\ny_pred = pd.Series(model.predict_proba(X_test)[:, 1], index=X_test.index)\nprint(y_pred)","metadata":{"execution":{"iopub.status.busy":"2024-04-24T08:12:15.805416Z","iopub.execute_input":"2024-04-24T08:12:15.806731Z","iopub.status.idle":"2024-04-24T08:12:16.273735Z","shell.execute_reply.started":"2024-04-24T08:12:15.806679Z","shell.execute_reply":"2024-04-24T08:12:16.272168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_subm = pd.read_csv(ROOT / \"sample_submission.csv\")\ndf_subm = df_subm.set_index(\"case_id\")\n\ndf_subm[\"score\"] = y_pred","metadata":{"execution":{"iopub.status.busy":"2024-04-24T08:12:20.789167Z","iopub.execute_input":"2024-04-24T08:12:20.789618Z","iopub.status.idle":"2024-04-24T08:12:20.813294Z","shell.execute_reply.started":"2024-04-24T08:12:20.789582Z","shell.execute_reply":"2024-04-24T08:12:20.811976Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Check null: \", df_subm[\"score\"].isnull().any())\n\ndf_subm.head()","metadata":{"execution":{"iopub.status.busy":"2024-04-24T08:12:22.256909Z","iopub.execute_input":"2024-04-24T08:12:22.258209Z","iopub.status.idle":"2024-04-24T08:12:22.275605Z","shell.execute_reply.started":"2024-04-24T08:12:22.258162Z","shell.execute_reply":"2024-04-24T08:12:22.274380Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_subm.to_csv(\"submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2024-04-24T08:12:24.390071Z","iopub.execute_input":"2024-04-24T08:12:24.391290Z","iopub.status.idle":"2024-04-24T08:12:24.406081Z","shell.execute_reply.started":"2024-04-24T08:12:24.391241Z","shell.execute_reply":"2024-04-24T08:12:24.404518Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}