{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "54c4cb63", "metadata": { "execution": { "iopub.execute_input": "2023-08-07T01:10:14.529709Z", "iopub.status.busy": "2023-08-07T01:10:14.529349Z", "iopub.status.idle": "2023-08-07T01:10:17.073736Z", "shell.execute_reply": "2023-08-07T01:10:17.072654Z" }, "papermill": { "duration": 2.562251, "end_time": "2023-08-07T01:10:17.076306", "exception": false, "start_time": "2023-08-07T01:10:14.514055", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "import os, sys, time, copy, datetime\n", "from pathlib import Path\n", "from tqdm.auto import tqdm\n", "tqdm.pandas()\n", "\n", "import numpy as np\n", "import pandas as pd\n", "\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "\n", "from sklearn import preprocessing\n", "from sklearn import feature_selection\n", "from sklearn import model_selection\n", "from sklearn import linear_model\n", "from sklearn import ensemble\n", "from sklearn import metrics\n", "from sklearn.utils.class_weight import compute_class_weight\n", "from sklearn.pipeline import Pipeline\n", "from sklearn.compose import ColumnTransformer\n", "from sklearn import decomposition\n", "from sklearn.calibration import CalibratedClassifierCV\n", "from sklearn import feature_selection\n", "\n", "import xgboost as xgb\n", "\n", "from sklearn.experimental import enable_iterative_imputer\n", "from sklearn import impute\n", "# from sklearn.impute import IterativeImputer, SimpleImputer, KNNImputer\n", "\n", "from imblearn.over_sampling import SMOTE" ] }, { "cell_type": "code", "execution_count": 2, "id": "eba79b03", "metadata": { "execution": { "iopub.execute_input": "2023-08-07T01:10:17.100909Z", "iopub.status.busy": "2023-08-07T01:10:17.100495Z", "iopub.status.idle": "2023-08-07T01:10:17.108685Z", "shell.execute_reply": "2023-08-07T01:10:17.107598Z" }, "papermill": { "duration": 0.023091, "end_time": "2023-08-07T01:10:17.111042", "exception": false, "start_time": "2023-08-07T01:10:17.087951", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "{'seed': 2023}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "config = dict(\n", " seed = 2023\n", ")\n", "config" ] }, { "cell_type": "code", "execution_count": 3, "id": "3f2ef74d", "metadata": { "execution": { "iopub.execute_input": "2023-08-07T01:10:17.136586Z", "iopub.status.busy": "2023-08-07T01:10:17.135799Z", "iopub.status.idle": "2023-08-07T01:10:17.143260Z", "shell.execute_reply": "2023-08-07T01:10:17.142268Z" }, "papermill": { "duration": 0.022965, "end_time": "2023-08-07T01:10:17.145523", "exception": false, "start_time": "2023-08-07T01:10:17.122558", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "['sample_submission.csv', 'greeks.csv', 'train.csv', 'test.csv']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "DATA_DIR = Path(\"../input/icr-identify-age-related-conditions/\")\n", "os.listdir(DATA_DIR)" ] }, { "cell_type": "code", "execution_count": 4, "id": "e13d8906", "metadata": { "execution": { "iopub.execute_input": "2023-08-07T01:10:17.170828Z", "iopub.status.busy": "2023-08-07T01:10:17.170410Z", "iopub.status.idle": "2023-08-07T01:10:17.231981Z", "shell.execute_reply": "2023-08-07T01:10:17.230845Z" }, "papermill": { "duration": 0.077258, "end_time": "2023-08-07T01:10:17.234558", "exception": false, "start_time": "2023-08-07T01:10:17.157300", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Train shape: (617, 58)\n", "Test shape: (5, 57)\n", "Greek shape: (617, 6)\n" ] } ], "source": [ "train_df = pd.read_csv(DATA_DIR/'train.csv')\n", "greek_df = pd.read_csv(DATA_DIR/'greeks.csv')\n", "test_df = pd.read_csv(DATA_DIR/'test.csv')\n", "sample_df = pd.read_csv(DATA_DIR/'sample_submission.csv')\n", "\n", "train_df.columns = train_df.columns.str.replace(' ', '')\n", "test_df.columns = test_df.columns.str.replace(' ', '')\n", "greek_df.columns = greek_df.columns.str.replace(' ', '')\n", "\n", "print(f\"Train shape: {train_df.shape}\")\n", "print(f\"Test shape: {test_df.shape}\")\n", "print(f\"Greek shape: {greek_df.shape}\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "4c065a2b", "metadata": { "execution": { "iopub.execute_input": "2023-08-07T01:10:17.260585Z", "iopub.status.busy": "2023-08-07T01:10:17.259520Z", "iopub.status.idle": "2023-08-07T01:10:17.306156Z", "shell.execute_reply": "2023-08-07T01:10:17.305052Z" }, "papermill": { "duration": 0.062386, "end_time": "2023-08-07T01:10:17.308653", "exception": false, "start_time": "2023-08-07T01:10:17.246267", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
| \n", " | Id | \n", "AB | \n", "AF | \n", "AH | \n", "AM | \n", "AR | \n", "AX | \n", "AY | \n", "AZ | \n", "BC | \n", "... | \n", "FL | \n", "FR | \n", "FS | \n", "GB | \n", "GE | \n", "GF | \n", "GH | \n", "GI | \n", "GL | \n", "Class | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "000ff2bfdfe9 | \n", "0.209377 | \n", "3109.03329 | \n", "85.200147 | \n", "22.394407 | \n", "8.138688 | \n", "0.699861 | \n", "0.025578 | \n", "9.812214 | \n", "5.555634 | \n", "... | \n", "7.298162 | \n", "1.73855 | \n", "0.094822 | \n", "11.339138 | \n", "72.611063 | \n", "2003.810319 | \n", "22.136229 | \n", "69.834944 | \n", "0.120343 | \n", "1 | \n", "
| 1 | \n", "007255e47698 | \n", "0.145282 | \n", "978.76416 | \n", "85.200147 | \n", "36.968889 | \n", "8.138688 | \n", "3.632190 | \n", "0.025578 | \n", "13.517790 | \n", "1.229900 | \n", "... | \n", "0.173229 | \n", "0.49706 | \n", "0.568932 | \n", "9.292698 | \n", "72.611063 | \n", "27981.562750 | \n", "29.135430 | \n", "32.131996 | \n", "21.978000 | \n", "0 | \n", "
| 2 | \n", "013f2bd269f5 | \n", "0.470030 | \n", "2635.10654 | \n", "85.200147 | \n", "32.360553 | \n", "8.138688 | \n", "6.732840 | \n", "0.025578 | \n", "12.824570 | \n", "1.229900 | \n", "... | \n", "7.709560 | \n", "0.97556 | \n", "1.198821 | \n", "37.077772 | \n", "88.609437 | \n", "13676.957810 | \n", "28.022851 | \n", "35.192676 | \n", "0.196941 | \n", "0 | \n", "
| 3 | \n", "043ac50845d5 | \n", "0.252107 | \n", "3819.65177 | \n", "120.201618 | \n", "77.112203 | \n", "8.138688 | \n", "3.685344 | \n", "0.025578 | \n", "11.053708 | \n", "1.229900 | \n", "... | \n", "6.122162 | \n", "0.49706 | \n", "0.284466 | \n", "18.529584 | \n", "82.416803 | \n", "2094.262452 | \n", "39.948656 | \n", "90.493248 | \n", "0.155829 | \n", "0 | \n", "
| 4 | \n", "044fb8a146ec | \n", "0.380297 | \n", "3733.04844 | \n", "85.200147 | \n", "14.103738 | \n", "8.138688 | \n", "3.942255 | \n", "0.054810 | \n", "3.396778 | \n", "102.151980 | \n", "... | \n", "8.153058 | \n", "48.50134 | \n", "0.121914 | \n", "16.408728 | \n", "146.109943 | \n", "8524.370502 | \n", "45.381316 | \n", "36.262628 | \n", "0.096614 | \n", "1 | \n", "
5 rows × 58 columns
\n", "| \n", " | Id | \n", "AB | \n", "AF | \n", "AH | \n", "AM | \n", "AR | \n", "AX | \n", "AY | \n", "AZ | \n", "BC | \n", "... | \n", "FI | \n", "FL | \n", "FR | \n", "FS | \n", "GB | \n", "GE | \n", "GF | \n", "GH | \n", "GI | \n", "GL | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "00eed32682bb | \n", "-1.018705 | \n", "-1.522401 | \n", "-0.927922 | \n", "-0.558863 | \n", "-0.962863 | \n", "-2.173291 | \n", "-0.144715 | \n", "-2.428708 | \n", "-0.123575 | \n", "... | \n", "-3.446146 | \n", "-0.472606 | \n", "-0.070422 | \n", "-0.322899 | \n", "-2.074164 | \n", "-0.913536 | \n", "-0.758519 | \n", "-3.192311 | \n", "-1.394807 | \n", "-0.826082 | \n", "
| 1 | \n", "010ebe33f668 | \n", "-1.018705 | \n", "-1.522401 | \n", "-0.927922 | \n", "-0.558863 | \n", "-0.962863 | \n", "-2.173291 | \n", "-0.144715 | \n", "-2.428708 | \n", "-0.123575 | \n", "... | \n", "-3.446146 | \n", "-0.472606 | \n", "-0.070422 | \n", "-0.322899 | \n", "-2.074164 | \n", "-0.913536 | \n", "-0.758519 | \n", "-3.192311 | \n", "-1.394807 | \n", "-0.826082 | \n", "
| 2 | \n", "02fa521e1838 | \n", "-1.018705 | \n", "-1.522401 | \n", "-0.927922 | \n", "-0.558863 | \n", "-0.962863 | \n", "-2.173291 | \n", "-0.144715 | \n", "-2.428708 | \n", "-0.123575 | \n", "... | \n", "-3.446146 | \n", "-0.472606 | \n", "-0.070422 | \n", "-0.322899 | \n", "-2.074164 | \n", "-0.913536 | \n", "-0.758519 | \n", "-3.192311 | \n", "-1.394807 | \n", "-0.826082 | \n", "
| 3 | \n", "040e15f562a2 | \n", "-1.018705 | \n", "-1.522401 | \n", "-0.927922 | \n", "-0.558863 | \n", "-0.962863 | \n", "-2.173291 | \n", "-0.144715 | \n", "-2.428708 | \n", "-0.123575 | \n", "... | \n", "-3.446146 | \n", "-0.472606 | \n", "-0.070422 | \n", "-0.322899 | \n", "-2.074164 | \n", "-0.913536 | \n", "-0.758519 | \n", "-3.192311 | \n", "-1.394807 | \n", "-0.826082 | \n", "
| 4 | \n", "046e85c7cc7f | \n", "-1.018705 | \n", "-1.522401 | \n", "-0.927922 | \n", "-0.558863 | \n", "-0.962863 | \n", "-2.173291 | \n", "-0.144715 | \n", "-2.428708 | \n", "-0.123575 | \n", "... | \n", "-3.446146 | \n", "-0.472606 | \n", "-0.070422 | \n", "-0.322899 | \n", "-2.074164 | \n", "-0.913536 | \n", "-0.758519 | \n", "-3.192311 | \n", "-1.394807 | \n", "-0.826082 | \n", "
5 rows × 57 columns
\n", "| \n", " | Id | \n", "class_0 | \n", "class_1 | \n", "
|---|---|---|---|
| 0 | \n", "00eed32682bb | \n", "0.672654 | \n", "0.327346 | \n", "
| 1 | \n", "010ebe33f668 | \n", "0.672654 | \n", "0.327346 | \n", "
| 2 | \n", "02fa521e1838 | \n", "0.672654 | \n", "0.327346 | \n", "
| 3 | \n", "040e15f562a2 | \n", "0.672654 | \n", "0.327346 | \n", "
| 4 | \n", "046e85c7cc7f | \n", "0.672654 | \n", "0.327346 | \n", "