{"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"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":84896,"databundleVersionId":10305135,"sourceType":"competition"}],"dockerImageVersionId":30822,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install japanize_matplotlib\n!pip install ydata_profiling","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T02:59:01.038163Z","iopub.execute_input":"2024-12-24T02:59:01.038568Z","iopub.status.idle":"2024-12-24T02:59:10.022484Z","shell.execute_reply.started":"2024-12-24T02:59:01.038537Z","shell.execute_reply":"2024-12-24T02:59:10.020769Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import pandas as pd\nimport ydata_profiling\n\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n%matplotlib inline\nimport japanize_matplotlib","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T02:59:10.025282Z","iopub.execute_input":"2024-12-24T02:59:10.025711Z","iopub.status.idle":"2024-12-24T02:59:10.038888Z","shell.execute_reply.started":"2024-12-24T02:59:10.025674Z","shell.execute_reply":"2024-12-24T02:59:10.037121Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Load Data","metadata":{}},{"cell_type":"code","source":"#PATH_INPUT = '../ignore_dir/input/'\nPATH_INPUT = '/kaggle/input/playground-series-s4e12/'","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T02:59:10.041677Z","iopub.execute_input":"2024-12-24T02:59:10.042062Z","iopub.status.idle":"2024-12-24T02:59:10.060719Z","shell.execute_reply.started":"2024-12-24T02:59:10.042033Z","shell.execute_reply":"2024-12-24T02:59:10.059465Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = pd.read_csv(PATH_INPUT + 'train.csv', index_col='id')\ntest  = pd.read_csv(PATH_INPUT + 'test.csv', index_col='id')\nsample = pd.read_csv(PATH_INPUT + 'sample_submission.csv', index_col='id')\nprint(train.shape, test.shape, sample.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T02:59:10.062523Z","iopub.execute_input":"2024-12-24T02:59:10.063023Z","iopub.status.idle":"2024-12-24T02:59:21.097649Z","shell.execute_reply.started":"2024-12-24T02:59:10.062975Z","shell.execute_reply":"2024-12-24T02:59:21.096025Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train.profile_report()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T02:59:21.0991Z","iopub.execute_input":"2024-12-24T02:59:21.09948Z","iopub.status.idle":"2024-12-24T03:01:05.15966Z","shell.execute_reply.started":"2024-12-24T02:59:21.09945Z","shell.execute_reply":"2024-12-24T03:01:05.158017Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#test.profile_report()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:05.16231Z","iopub.execute_input":"2024-12-24T03:01:05.162861Z","iopub.status.idle":"2024-12-24T03:01:05.168559Z","shell.execute_reply.started":"2024-12-24T03:01:05.162805Z","shell.execute_reply":"2024-12-24T03:01:05.167204Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Def","metadata":{}},{"cell_type":"code","source":"def plot_scatter(label_x, label_y, s=10, alpha=0.01):\n    plt.scatter(train[label_x], train[label_y], s=s, alpha=alpha)\n    plt.xlabel(label_x)\n    plt.ylabel(label_y)\n    plt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:05.170385Z","iopub.execute_input":"2024-12-24T03:01:05.17083Z","iopub.status.idle":"2024-12-24T03:01:05.181222Z","shell.execute_reply.started":"2024-12-24T03:01:05.170781Z","shell.execute_reply":"2024-12-24T03:01:05.179851Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def plot_hist(feature, items, target, bins=50, drop_na=False):\n    for item in items:\n        if drop_na:\n            plt.hist(train.loc[train[feature]==item, target].dropna(), bins=bins, alpha=1/len(items), label=item)\n        else:\n            plt.hist(train.loc[train[feature]==item, target], bins=bins, alpha=1/len(items), label=item)\n    plt.xlabel(target)\n    plt.ylabel('count')\n    plt.legend(title=feature)\n    plt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:05.18253Z","iopub.execute_input":"2024-12-24T03:01:05.182848Z","iopub.status.idle":"2024-12-24T03:01:05.193463Z","shell.execute_reply.started":"2024-12-24T03:01:05.182815Z","shell.execute_reply":"2024-12-24T03:01:05.19183Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Relation Feature and Target","metadata":{}},{"cell_type":"code","source":"# Gender: 性別\nfeature = 'Gender'\ntarget = 'Premium Amount'\nitems = list(train['Gender'].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:05.194739Z","iopub.execute_input":"2024-12-24T03:01:05.195223Z","iopub.status.idle":"2024-12-24T03:01:05.917714Z","shell.execute_reply.started":"2024-12-24T03:01:05.195156Z","shell.execute_reply":"2024-12-24T03:01:05.916409Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Age: 年齢\nplot_scatter('Age', 'Premium Amount', s=10, alpha=0.005)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:05.918928Z","iopub.execute_input":"2024-12-24T03:01:05.919376Z","iopub.status.idle":"2024-12-24T03:01:07.515728Z","shell.execute_reply.started":"2024-12-24T03:01:05.919315Z","shell.execute_reply":"2024-12-24T03:01:07.514459Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Annual Income: 年収\nplot_scatter('Annual Income', 'Premium Amount', s=5, alpha=0.005)\n# '''\n# 年収が少ないと、保険料は高い(つらい世界…)\n# →相関係数はほぼ0だった。\n# '''","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:24.736074Z","iopub.execute_input":"2024-12-24T03:01:24.736638Z","iopub.status.idle":"2024-12-24T03:01:25.995644Z","shell.execute_reply.started":"2024-12-24T03:01:24.736588Z","shell.execute_reply":"2024-12-24T03:01:25.994392Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Marital Status: 婚姻状況 \nfeature = 'Marital Status'\ntarget = 'Premium Amount'\nitems = list(train['Marital Status'].unique())[:-1]\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:26:09.793876Z","iopub.execute_input":"2024-12-24T03:26:09.794368Z","iopub.status.idle":"2024-12-24T03:26:10.667764Z","shell.execute_reply.started":"2024-12-24T03:26:09.794316Z","shell.execute_reply":"2024-12-24T03:26:10.666497Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Number of Dependents: 扶養家族の数\nplot_scatter('Number of Dependents', 'Premium Amount', s=20, alpha=0.002)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:25.997134Z","iopub.execute_input":"2024-12-24T03:01:25.997503Z","iopub.status.idle":"2024-12-24T03:01:28.57289Z","shell.execute_reply.started":"2024-12-24T03:01:25.997472Z","shell.execute_reply":"2024-12-24T03:01:28.571738Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Number of Dependents: 扶養家族の数\nfeature = 'Number of Dependents'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nitems\nplot_hist(feature=feature, items=items, target=target, drop_na=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:28.574861Z","iopub.execute_input":"2024-12-24T03:01:28.575283Z","iopub.status.idle":"2024-12-24T03:01:29.492007Z","shell.execute_reply.started":"2024-12-24T03:01:28.575241Z","shell.execute_reply":"2024-12-24T03:01:29.490288Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Education Level: 教育レベル\nfeature = 'Education Level'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:29.493551Z","iopub.execute_input":"2024-12-24T03:01:29.493997Z","iopub.status.idle":"2024-12-24T03:01:30.618688Z","shell.execute_reply.started":"2024-12-24T03:01:29.493958Z","shell.execute_reply":"2024-12-24T03:01:30.617374Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Occupation: 職業\nfeature = 'Occupation'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:01:30.61979Z","iopub.execute_input":"2024-12-24T03:01:30.620102Z","iopub.status.idle":"2024-12-24T03:01:31.562403Z","shell.execute_reply.started":"2024-12-24T03:01:30.620075Z","shell.execute_reply":"2024-12-24T03:01:31.560924Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Health Score: 健康スコア\nplot_scatter('Health Score', 'Premium Amount', s=5, alpha=0.005)\n# '''\n# 健康スコアが低い人は保険料が少ない（不養生…?無関心…?）\n# 健康スコアが高い人も保険料が少ない（自信の表れ…?）\n# →相関係数はほぼ0だった。\n# '''","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:02:33.009482Z","iopub.execute_input":"2024-12-24T03:02:33.009981Z","iopub.status.idle":"2024-12-24T03:02:34.27837Z","shell.execute_reply.started":"2024-12-24T03:02:33.009944Z","shell.execute_reply":"2024-12-24T03:02:34.276982Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Occupation: 職業\nfeature = 'Location'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:26:57.721738Z","iopub.execute_input":"2024-12-23T23:26:57.722092Z","iopub.status.idle":"2024-12-23T23:26:58.703094Z","shell.execute_reply.started":"2024-12-23T23:26:57.722061Z","shell.execute_reply":"2024-12-23T23:26:58.701534Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Policy Type: 保険タイプ\nfeature = 'Policy Type'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:26:58.704255Z","iopub.execute_input":"2024-12-23T23:26:58.704627Z","iopub.status.idle":"2024-12-23T23:26:59.644023Z","shell.execute_reply.started":"2024-12-23T23:26:58.704594Z","shell.execute_reply":"2024-12-23T23:26:59.642822Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Previous Claims: 過去の請求\nfeature = 'Previous Claims'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=True)\n# '''\n# 相関係数0.047\n# '''","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:03:37.365386Z","iopub.execute_input":"2024-12-24T03:03:37.3659Z","iopub.status.idle":"2024-12-24T03:03:39.228838Z","shell.execute_reply.started":"2024-12-24T03:03:37.365844Z","shell.execute_reply":"2024-12-24T03:03:39.227463Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Previous Claims: 過去の請求\nplot_scatter('Previous Claims', 'Premium Amount', s=20, alpha=0.005)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:21:43.726696Z","iopub.execute_input":"2024-12-24T03:21:43.727238Z","iopub.status.idle":"2024-12-24T03:21:45.427955Z","shell.execute_reply.started":"2024-12-24T03:21:43.727199Z","shell.execute_reply":"2024-12-24T03:21:45.426778Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Vehicle Age: 車齢\nplot_scatter('Vehicle Age', 'Premium Amount', s=20, alpha=0.005)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:01.16221Z","iopub.execute_input":"2024-12-23T23:27:01.162601Z","iopub.status.idle":"2024-12-23T23:27:03.123603Z","shell.execute_reply.started":"2024-12-23T23:27:01.162557Z","shell.execute_reply":"2024-12-23T23:27:03.122532Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Credit Score: 信用スコア\nplot_scatter('Credit Score', 'Premium Amount', s=5, alpha=0.002)\n# '''\n# 少し相関ありそう\n# スコアが低いと、保険料も少ない\n# →相関係数はほぼゼロだった\n# '''","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:04:17.621433Z","iopub.execute_input":"2024-12-24T03:04:17.621815Z","iopub.status.idle":"2024-12-24T03:04:18.842037Z","shell.execute_reply.started":"2024-12-24T03:04:17.621788Z","shell.execute_reply":"2024-12-24T03:04:18.840721Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Insurance Duration: 保険期間\nplot_scatter('Insurance Duration', 'Premium Amount', s=20, alpha=0.005)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:04.21119Z","iopub.execute_input":"2024-12-23T23:27:04.211616Z","iopub.status.idle":"2024-12-23T23:27:06.233675Z","shell.execute_reply.started":"2024-12-23T23:27:04.211575Z","shell.execute_reply":"2024-12-23T23:27:06.232613Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Customer Feedback: 顧客フィードバック\nfeature = 'Customer Feedback'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:06.234905Z","iopub.execute_input":"2024-12-23T23:27:06.235339Z","iopub.status.idle":"2024-12-23T23:27:07.189273Z","shell.execute_reply.started":"2024-12-23T23:27:06.235294Z","shell.execute_reply":"2024-12-23T23:27:07.188137Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Smoking Status: 喫煙ステータス\nfeature = 'Smoking Status'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:07.194063Z","iopub.execute_input":"2024-12-23T23:27:07.194382Z","iopub.status.idle":"2024-12-23T23:27:07.823066Z","shell.execute_reply.started":"2024-12-23T23:27:07.194354Z","shell.execute_reply":"2024-12-23T23:27:07.822088Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Exercise Frequency: 運動頻度\nfeature = 'Exercise Frequency'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-24T03:27:15.393166Z","iopub.execute_input":"2024-12-24T03:27:15.393704Z","iopub.status.idle":"2024-12-24T03:27:16.908597Z","shell.execute_reply.started":"2024-12-24T03:27:15.393621Z","shell.execute_reply":"2024-12-24T03:27:16.907265Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Property Type: 物件タイプ\nfeature = 'Property Type'\ntarget = 'Premium Amount'\nitems = list(train[feature].unique())\nprint(items)\nplot_hist(feature=feature, items=items, target=target, drop_na=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:08.450969Z","iopub.execute_input":"2024-12-23T23:27:08.451382Z","iopub.status.idle":"2024-12-23T23:27:09.311027Z","shell.execute_reply.started":"2024-12-23T23:27:08.45134Z","shell.execute_reply":"2024-12-23T23:27:09.309894Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"## 保険料の分布\nplt.hist(train['Premium Amount'], bins=10)\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:09.312227Z","iopub.execute_input":"2024-12-23T23:27:09.312632Z","iopub.status.idle":"2024-12-23T23:27:09.575713Z","shell.execute_reply.started":"2024-12-23T23:27:09.312593Z","shell.execute_reply":"2024-12-23T23:27:09.57464Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.hist(train['Premium Amount'], bins=50)\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:09.576682Z","iopub.execute_input":"2024-12-23T23:27:09.576971Z","iopub.status.idle":"2024-12-23T23:27:09.871279Z","shell.execute_reply.started":"2024-12-23T23:27:09.576944Z","shell.execute_reply":"2024-12-23T23:27:09.870153Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 相関係数\ncol_categorical = []\ncol_numeric = []\nfor c in train.columns:\n    if train[c].dtypes == 'object':\n        col_categorical.append(c)\n    else:\n        col_numeric.append(c)\nprint(col_categorical)\nprint(col_numeric)\nsns.heatmap(train[col_numeric].corr(), annot=True, fmt='.3f')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:09.872332Z","iopub.execute_input":"2024-12-23T23:27:09.872631Z","iopub.status.idle":"2024-12-23T23:27:10.826792Z","shell.execute_reply.started":"2024-12-23T23:27:09.872592Z","shell.execute_reply":"2024-12-23T23:27:10.825607Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Feature Engineering","metadata":{}},{"cell_type":"code","source":"# Income-Age: 年収/年齢\ntrain['Income-Age'] = train['Annual Income'] / train['Age']\nplot_scatter('Income-Age', 'Premium Amount', s=20, alpha=0.002)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:10.828265Z","iopub.execute_input":"2024-12-23T23:27:10.828601Z","iopub.status.idle":"2024-12-23T23:27:12.97446Z","shell.execute_reply.started":"2024-12-23T23:27:10.828571Z","shell.execute_reply":"2024-12-23T23:27:12.97335Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Credit Score-Age: 信用スコア/年齢\nnew_col = 'CScore-Age'\ntrain[new_col] = train['Credit Score'] / train['Age']\nplot_scatter(new_col, 'Premium Amount', s=20, alpha=0.002)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:12.975555Z","iopub.execute_input":"2024-12-23T23:27:12.975851Z","iopub.status.idle":"2024-12-23T23:27:14.759151Z","shell.execute_reply.started":"2024-12-23T23:27:12.975824Z","shell.execute_reply":"2024-12-23T23:27:14.758101Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Health Score-Age: 健康スコア/年齢\nnew_col = 'HScore-Age'\ntrain[new_col] = train['Health Score'] / train['Age']\nplot_scatter(new_col, 'Premium Amount', s=20, alpha=0.002)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:14.7604Z","iopub.execute_input":"2024-12-23T23:27:14.760772Z","iopub.status.idle":"2024-12-23T23:27:16.575478Z","shell.execute_reply.started":"2024-12-23T23:27:14.760737Z","shell.execute_reply":"2024-12-23T23:27:16.574472Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Annual Income-Number of Dependents: 年収/扶養家族の数\nnew_col = 'Income-Dependents'\ntrain[new_col] = train['Annual Income'] / train['Number of Dependents']\nplot_scatter(new_col, 'Premium Amount', s=20, alpha=0.002)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:16.576514Z","iopub.execute_input":"2024-12-23T23:27:16.576802Z","iopub.status.idle":"2024-12-23T23:27:18.072612Z","shell.execute_reply.started":"2024-12-23T23:27:16.576778Z","shell.execute_reply":"2024-12-23T23:27:18.071585Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Annual Income-Credit Score: 年収/信用スコア\nnew_col = 'Income-CScore'\ntrain[new_col] = train['Annual Income'] / train['Credit Score']\nplot_scatter(new_col, 'Premium Amount', s=20, alpha=0.002)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:18.073761Z","iopub.execute_input":"2024-12-23T23:27:18.074214Z","iopub.status.idle":"2024-12-23T23:27:19.785716Z","shell.execute_reply.started":"2024-12-23T23:27:18.074171Z","shell.execute_reply":"2024-12-23T23:27:19.784588Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 相関係数\ncol_categorical = []\ncol_numeric = []\ncol_new = ['Income-Age', 'CScore-Age', 'HScore-Age', 'Income-Dependents', 'Income-CScore'] + ['Premium Amount']\nfor c in col_new: #train.columns:\n    if train[c].dtypes == 'object':\n        col_categorical.append(c)\n    else:\n        col_numeric.append(c)\nprint(col_categorical)\nprint(col_numeric)\nsns.heatmap(train[col_numeric].corr(), annot=True, fmt='.3f')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-23T23:27:19.78708Z","iopub.execute_input":"2024-12-23T23:27:19.787539Z","iopub.status.idle":"2024-12-23T23:27:20.424933Z","shell.execute_reply.started":"2024-12-23T23:27:19.787498Z","shell.execute_reply":"2024-12-23T23:27:20.424059Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}