{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.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":84896,"databundleVersionId":10305135,"sourceType":"competition"}],"dockerImageVersionId":31089,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:32:16.012104Z","iopub.execute_input":"2025-07-17T04:32:16.012388Z","iopub.status.idle":"2025-07-17T04:32:18.706851Z","shell.execute_reply.started":"2025-07-17T04:32:16.012366Z","shell.execute_reply":"2025-07-17T04:32:18.70589Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"import pandas as pd\n\ntrain = pd.read_csv(\"/kaggle/input/playground-series-s4e12/train.csv\")\ntest = pd.read_csv(\"/kaggle/input/playground-series-s4e12/test.csv\")\n\n\nprint(\"Train shape:\", train.shape)\nprint(\"Test shape:\", test.shape)\ntrain.head()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:32:18.70845Z","iopub.execute_input":"2025-07-17T04:32:18.709137Z","iopub.status.idle":"2025-07-17T04:32:30.916365Z","shell.execute_reply.started":"2025-07-17T04:32:18.709101Z","shell.execute_reply":"2025-07-17T04:32:30.915423Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Linear Regression\n","metadata":{}},{"cell_type":"markdown","source":"# PCA+ SVR","metadata":{}},{"cell_type":"markdown","source":"# Decision tree","metadata":{}},{"cell_type":"code","source":"train.info()\ntrain.describe()\ntrain.isnull().sum()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:32:54.434346Z","iopub.execute_input":"2025-07-17T04:32:54.434707Z","iopub.status.idle":"2025-07-17T04:32:56.545242Z","shell.execute_reply.started":"2025-07-17T04:32:54.434643Z","shell.execute_reply":"2025-07-17T04:32:56.544221Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt\n\nplt.figure(figsize=(8, 4))\nsns.histplot(train['Premium Amount'], bins=50, kde=True)\nplt.title(\"Distribution of Insurance Premium\")\nplt.xlabel(\"PremiumAmount\")\nplt.show()\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:34:22.549987Z","iopub.execute_input":"2025-07-17T04:34:22.550323Z","iopub.status.idle":"2025-07-17T04:34:28.587405Z","shell.execute_reply.started":"2025-07-17T04:34:22.550297Z","shell.execute_reply":"2025-07-17T04:34:28.586426Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"num_cols = [\n    'Age', 'Annual Income', 'Number of Dependents',\n    'Health Score', 'Previous Claims', 'Vehicle Age',\n    'Credit Score', 'Insurance Duration'\n]\ncat_cols = [\n    'Gender', 'Marital Status', 'Education Level', 'Occupation',\n    'Location', 'Policy Type', 'Customer Feedback', 'Smoking Status',\n    'Exercise Frequency', 'Property Type'\n]\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:35:46.818917Z","iopub.execute_input":"2025-07-17T04:35:46.819342Z","iopub.status.idle":"2025-07-17T04:35:46.824954Z","shell.execute_reply.started":"2025-07-17T04:35:46.819312Z","shell.execute_reply":"2025-07-17T04:35:46.823722Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from sklearn.impute import SimpleImputer\n\nnum_imputer = SimpleImputer(strategy=\"mean\")\ntrain[num_cols] = num_imputer.fit_transform(train[num_cols])\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:35:53.801447Z","iopub.execute_input":"2025-07-17T04:35:53.801763Z","iopub.status.idle":"2025-07-17T04:35:54.763931Z","shell.execute_reply.started":"2025-07-17T04:35:53.801739Z","shell.execute_reply":"2025-07-17T04:35:54.762839Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"cat_imputer = SimpleImputer(strategy=\"most_frequent\")\ntrain[cat_cols] = cat_imputer.fit_transform(train[cat_cols])\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:36:14.497432Z","iopub.execute_input":"2025-07-17T04:36:14.497803Z","iopub.status.idle":"2025-07-17T04:36:16.667305Z","shell.execute_reply.started":"2025-07-17T04:36:14.497775Z","shell.execute_reply":"2025-07-17T04:36:16.666146Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from sklearn.preprocessing import OrdinalEncoder\n\nencoder = OrdinalEncoder()\ntrain[cat_cols] = encoder.fit_transform(train[cat_cols])\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:36:26.576435Z","iopub.execute_input":"2025-07-17T04:36:26.576826Z","iopub.status.idle":"2025-07-17T04:36:29.805488Z","shell.execute_reply.started":"2025-07-17T04:36:26.576791Z","shell.execute_reply":"2025-07-17T04:36:29.804175Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train.info()\ntrain.describe()\ntrain.isnull().sum()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-07-17T04:37:04.794313Z","iopub.execute_input":"2025-07-17T04:37:04.795139Z","iopub.status.idle":"2025-07-17T04:37:06.445695Z","shell.execute_reply.started":"2025-07-17T04:37:04.795105Z","shell.execute_reply":"2025-07-17T04:37:06.444724Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Auto + MLP\n","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}