{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":81933,"databundleVersionId":9643020,"sourceType":"competition"}],"dockerImageVersionId":30761,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"raw","source":"# **CMI EDA**\n\n","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport plotly.express as px\nimport plotly.graph_objects as go\nimport warnings\nwarnings.filterwarnings('ignore')\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-09-22T10:34:34.780057Z","iopub.execute_input":"2024-09-22T10:34:34.780512Z","iopub.status.idle":"2024-09-22T10:34:35.573697Z","shell.execute_reply.started":"2024-09-22T10:34:34.780469Z","shell.execute_reply":"2024-09-22T10:34:35.572554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df = pd.read_csv(\"/kaggle/input/child-mind-institute-problematic-internet-use/train.csv\")\ntest_Df = pd.read_csv(\"/kaggle/input/child-mind-institute-problematic-internet-use/test.csv\")\nsub = pd.read_csv(\"/kaggle/input/child-mind-institute-problematic-internet-use/sample_submission.csv\")\ndata_dic = pd.read_csv('/kaggle/input/child-mind-institute-problematic-internet-use/data_dictionary.csv')","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:33:11.079915Z","iopub.execute_input":"2024-09-22T10:33:11.080383Z","iopub.status.idle":"2024-09-22T10:33:11.149039Z","shell.execute_reply.started":"2024-09-22T10:33:11.080339Z","shell.execute_reply":"2024-09-22T10:33:11.148056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"\n**Steps:**\n\n# **1. Initial Data Overview:**","metadata":{}},{"cell_type":"code","source":"# Examine the first 5 rows\ntrain_df.head()\n","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:33:40.151892Z","iopub.execute_input":"2024-09-22T10:33:40.152341Z","iopub.status.idle":"2024-09-22T10:33:40.194885Z","shell.execute_reply.started":"2024-09-22T10:33:40.152285Z","shell.execute_reply":"2024-09-22T10:33:40.193617Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Check the dataset dimensions\ntrain_df.shape","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:33:31.641811Z","iopub.execute_input":"2024-09-22T10:33:31.642836Z","iopub.status.idle":"2024-09-22T10:33:31.651765Z","shell.execute_reply.started":"2024-09-22T10:33:31.642788Z","shell.execute_reply":"2024-09-22T10:33:31.650486Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Examine data types and missing values\ntrain_df.info()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:33:32.492782Z","iopub.execute_input":"2024-09-22T10:33:32.493207Z","iopub.status.idle":"2024-09-22T10:33:32.513500Z","shell.execute_reply.started":"2024-09-22T10:33:32.493167Z","shell.execute_reply":"2024-09-22T10:33:32.512356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **2. Visualization: Missing Data Percentages**","metadata":{}},{"cell_type":"code","source":"# Calculate missing data percentages\nmissing_percentages = train_df.isnull().sum() / len(train_df) * 100\n\n# Visualize missing data percentages (bar chart)\nfig = px.bar(missing_percentages, x=missing_percentages.index, y=missing_percentages.values,\n             labels={'x':'Variables', 'y':'Missing Data Percentage (%)'},\n             title='Missing Data Percentages')\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:34:39.971184Z","iopub.execute_input":"2024-09-22T10:34:39.971845Z","iopub.status.idle":"2024-09-22T10:34:42.162331Z","shell.execute_reply.started":"2024-09-22T10:34:39.971801Z","shell.execute_reply":"2024-09-22T10:34:42.160963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **3. Target Variable (sii) Distribution**","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the sii variable (histogram)\nfig = px.histogram(train_df, x=\"sii\", \n                   title=\"Severity Impairment Index (sii) Distribution\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:35:00.625550Z","iopub.execute_input":"2024-09-22T10:35:00.626012Z","iopub.status.idle":"2024-09-22T10:35:00.740375Z","shell.execute_reply.started":"2024-09-22T10:35:00.625966Z","shell.execute_reply":"2024-09-22T10:35:00.739175Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **4. Age Distribution**","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the age variable (histogram)\nfig = px.histogram(train_df, x=\"Basic_Demos-Age\", \n                   title=\"Age Distribution\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:35:15.136812Z","iopub.execute_input":"2024-09-22T10:35:15.137382Z","iopub.status.idle":"2024-09-22T10:35:15.218221Z","shell.execute_reply.started":"2024-09-22T10:35:15.137324Z","shell.execute_reply":"2024-09-22T10:35:15.216912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **5. Gender Distribution**","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the gender variable (pie chart)\nfig = px.pie(train_df, names=\"Basic_Demos-Sex\", \n             title=\"Gender Distribution\",\n             labels={\"Basic_Demos-Sex\": \"Gender\"})\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:35:32.483215Z","iopub.execute_input":"2024-09-22T10:35:32.483689Z","iopub.status.idle":"2024-09-22T10:35:32.564671Z","shell.execute_reply.started":"2024-09-22T10:35:32.483646Z","shell.execute_reply":"2024-09-22T10:35:32.563537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **6. CGAS Score Distribution**","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the CGAS score variable (histogram)\nfig = px.histogram(train_df, x=\"CGAS-CGAS_Score\", \n                   title=\"CGAS Score Distribution\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:35:45.733199Z","iopub.execute_input":"2024-09-22T10:35:45.733797Z","iopub.status.idle":"2024-09-22T10:35:45.811825Z","shell.execute_reply.started":"2024-09-22T10:35:45.733729Z","shell.execute_reply":"2024-09-22T10:35:45.810384Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **7. BMI Distribution**\n","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the BMI variable (histogram)\nfig = px.histogram(train_df, x=\"Physical-BMI\", \n                   title=\"BMI Distribution\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:36:04.281355Z","iopub.execute_input":"2024-09-22T10:36:04.281773Z","iopub.status.idle":"2024-09-22T10:36:04.356631Z","shell.execute_reply.started":"2024-09-22T10:36:04.281735Z","shell.execute_reply":"2024-09-22T10:36:04.355369Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **8. Height and Weight Relationship**","metadata":{}},{"cell_type":"code","source":"# Visualize the relationship between height and weight (scatter plot)\nfig = px.scatter(train_df, x=\"Physical-Height\", y=\"Physical-Weight\", \n                 title=\"Height and Weight Relationship\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:36:20.801895Z","iopub.execute_input":"2024-09-22T10:36:20.802347Z","iopub.status.idle":"2024-09-22T10:36:20.908846Z","shell.execute_reply.started":"2024-09-22T10:36:20.802280Z","shell.execute_reply":"2024-09-22T10:36:20.907510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **9. Heart Rate Distribution**","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the heart rate variable (histogram)\nfig = px.histogram(train_df, x=\"Physical-HeartRate\", \n                   title=\"Heart Rate Distribution\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:36:35.210328Z","iopub.execute_input":"2024-09-22T10:36:35.211423Z","iopub.status.idle":"2024-09-22T10:36:35.284025Z","shell.execute_reply.started":"2024-09-22T10:36:35.211372Z","shell.execute_reply":"2024-09-22T10:36:35.282780Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **10. Blood Pressure Distributions**","metadata":{}},{"cell_type":"code","source":"# Visualize the distributions of systolic and diastolic blood pressure (box plot)\nfig = px.box(train_df, y=[\"Physical-Systolic_BP\", \"Physical-Diastolic_BP\"], \n             title=\"Blood Pressure Distributions\")\nfig.show()\n","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:36:51.165217Z","iopub.execute_input":"2024-09-22T10:36:51.165664Z","iopub.status.idle":"2024-09-22T10:36:51.316902Z","shell.execute_reply.started":"2024-09-22T10:36:51.165626Z","shell.execute_reply":"2024-09-22T10:36:51.315428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **11. Fitness and Endurance Values**","metadata":{}},{"cell_type":"code","source":"# Visualize the relationship between Max_Stage and Time_Mins variables (scatter plot)\nfig = px.scatter(train_df, x=\"Fitness_Endurance-Max_Stage\", y=\"Fitness_Endurance-Time_Mins\", \n                 title=\"Fitness and Endurance Relationship\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:37:02.322571Z","iopub.execute_input":"2024-09-22T10:37:02.323018Z","iopub.status.idle":"2024-09-22T10:37:02.399452Z","shell.execute_reply.started":"2024-09-22T10:37:02.322976Z","shell.execute_reply":"2024-09-22T10:37:02.398101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **12. Distributions of FGC Values**","metadata":{}},{"cell_type":"code","source":"# Visualize the distributions of FGC values (CU, GSND, GSD, PU, SRL, SRR, TL) (box plot)\nfgc_cols = [col for col in train_df.columns if col.startswith('FGC-FGC_')]\nfig = px.box(train_df, y=fgc_cols, \n             title=\"Distributions of FGC Values\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:37:13.761116Z","iopub.execute_input":"2024-09-22T10:37:13.761580Z","iopub.status.idle":"2024-09-22T10:37:14.027880Z","shell.execute_reply.started":"2024-09-22T10:37:13.761537Z","shell.execute_reply":"2024-09-22T10:37:14.026469Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **13. Distributions of BIA Values**","metadata":{}},{"cell_type":"code","source":"# Visualize the distributions of BIA values (BMC, BMI, BMR, DEE, ECW, FFM, FFMI, FMI, Fat) (box plot)\nbia_cols = [col for col in train_df.columns if col.startswith('BIA-BIA_')]\nfig = px.box(train_df, y=bia_cols, \n             title=\"Distributions of BIA Values\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:37:25.237622Z","iopub.execute_input":"2024-09-22T10:37:25.238105Z","iopub.status.idle":"2024-09-22T10:37:25.535553Z","shell.execute_reply.started":"2024-09-22T10:37:25.238064Z","shell.execute_reply":"2024-09-22T10:37:25.534370Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **14. PAQ_A and PAQ_C Total Values**","metadata":{}},{"cell_type":"code","source":"# Visualize the distributions of PAQ_A_Total and PAQ_C_Total values (histogram)\nfig = px.histogram(train_df, x=[\"PAQ_A-PAQ_A_Total\", \"PAQ_C-PAQ_C_Total\"], \n                   title=\"PAQ Total Values\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:37:47.972337Z","iopub.execute_input":"2024-09-22T10:37:47.972818Z","iopub.status.idle":"2024-09-22T10:37:48.073971Z","shell.execute_reply.started":"2024-09-22T10:37:47.972775Z","shell.execute_reply":"2024-09-22T10:37:48.072546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **15. Distributions of PCIAT Values**","metadata":{}},{"cell_type":"code","source":"# Visualize the distributions of PCIAT values (PCIAT_01 - PCIAT_20) (box plot)\npciat_cols = [col for col in train_df.columns if col.startswith('PCIAT-PCIAT_') and col != 'PCIAT-PCIAT_Total']\nfig = px.box(train_df, y=pciat_cols, \n             title=\"Distributions of PCIAT Values\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:37:57.297918Z","iopub.execute_input":"2024-09-22T10:37:57.298378Z","iopub.status.idle":"2024-09-22T10:37:57.668857Z","shell.execute_reply.started":"2024-09-22T10:37:57.298331Z","shell.execute_reply":"2024-09-22T10:37:57.667447Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **16. SDS Total Values**","metadata":{}},{"cell_type":"code","source":"# Visualize the distributions of SDS_Total_Raw and SDS_Total_T values (histogram)\nfig = px.histogram(train_df, x=[\"SDS-SDS_Total_Raw\", \"SDS-SDS_Total_T\"], \n                   title=\"SDS Total Values\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:38:14.463730Z","iopub.execute_input":"2024-09-22T10:38:14.464200Z","iopub.status.idle":"2024-09-22T10:38:14.550100Z","shell.execute_reply.started":"2024-09-22T10:38:14.464155Z","shell.execute_reply":"2024-09-22T10:38:14.548861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **17. Daily Computer/Internet Use**","metadata":{}},{"cell_type":"code","source":"# Visualize the distribution of the computerinternet_hoursday variable (histogram)\nfig = px.histogram(train_df, x=\"PreInt_EduHx-computerinternet_hoursday\", \n                   title=\"Daily Computer/Internet Use (Hours)\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:38:25.347460Z","iopub.execute_input":"2024-09-22T10:38:25.347922Z","iopub.status.idle":"2024-09-22T10:38:25.419871Z","shell.execute_reply.started":"2024-09-22T10:38:25.347879Z","shell.execute_reply":"2024-09-22T10:38:25.418563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **18. Correlation Matrix**","metadata":{}},{"cell_type":"code","source":"# Calculate and visualize the correlations between numerical variables (heatmap)\nnumerical_cols = train_df.select_dtypes(include=np.number).columns\ncorr_matrix = train_df[numerical_cols].corr()\nfig = px.imshow(corr_matrix, \n                title=\"Correlations Between Numerical Variables\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:38:43.667033Z","iopub.execute_input":"2024-09-22T10:38:43.667499Z","iopub.status.idle":"2024-09-22T10:38:43.834570Z","shell.execute_reply.started":"2024-09-22T10:38:43.667456Z","shell.execute_reply":"2024-09-22T10:38:43.833363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **19. Relationship Between Age and sii**","metadata":{}},{"cell_type":"code","source":"# Visualize the relationship between age and sii (scatter plot)\nfig = px.scatter(train_df, x=\"Basic_Demos-Age\", y=\"sii\", \n                 title=\"Relationship Between Age and sii\",\n                 trendline=\"ols\") \nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:38:56.814128Z","iopub.execute_input":"2024-09-22T10:38:56.814583Z","iopub.status.idle":"2024-09-22T10:38:59.207348Z","shell.execute_reply.started":"2024-09-22T10:38:56.814541Z","shell.execute_reply":"2024-09-22T10:38:59.206082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **20. Relationship Between Gender and sii**","metadata":{}},{"cell_type":"code","source":"# Visualize the relationship between gender and sii (box plot)\nfig = px.box(train_df, x=\"Basic_Demos-Sex\", y=\"sii\", \n             title=\"Relationship Between Gender and sii\",\n             labels={\"Basic_Demos-Sex\": \"Gender\"})\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:39:10.556346Z","iopub.execute_input":"2024-09-22T10:39:10.557077Z","iopub.status.idle":"2024-09-22T10:39:10.634925Z","shell.execute_reply.started":"2024-09-22T10:39:10.557029Z","shell.execute_reply":"2024-09-22T10:39:10.633750Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 21. Relationship Between CGAS Score and sii","metadata":{}},{"cell_type":"code","source":"fig = px.box(train_df, x=\"sii\", y=\"CGAS-CGAS_Score\", title=\"Relationship Between CGAS Score and sii\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:39:38.813756Z","iopub.execute_input":"2024-09-22T10:39:38.814218Z","iopub.status.idle":"2024-09-22T10:39:38.892031Z","shell.execute_reply.started":"2024-09-22T10:39:38.814178Z","shell.execute_reply":"2024-09-22T10:39:38.890746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 22. Relationship Between BMI and sii","metadata":{}},{"cell_type":"code","source":"fig = px.scatter(train_df, x=\"Physical-BMI\", y=\"sii\", title=\"Relationship Between BMI and sii\", trendline=\"ols\")\nfig.show()\n","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:39:54.363366Z","iopub.execute_input":"2024-09-22T10:39:54.363824Z","iopub.status.idle":"2024-09-22T10:39:54.448118Z","shell.execute_reply.started":"2024-09-22T10:39:54.363779Z","shell.execute_reply":"2024-09-22T10:39:54.446891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 23. Relationship Between Heart Rate and sii","metadata":{}},{"cell_type":"code","source":"fig = px.scatter(train_df, x=\"Physical-HeartRate\", y=\"sii\", title=\"Relationship Between Heart Rate and sii\", trendline=\"ols\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:40:08.962082Z","iopub.execute_input":"2024-09-22T10:40:08.962537Z","iopub.status.idle":"2024-09-22T10:40:09.044960Z","shell.execute_reply.started":"2024-09-22T10:40:08.962495Z","shell.execute_reply":"2024-09-22T10:40:09.043715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 24. Relationship Between Blood Pressure and sii","metadata":{}},{"cell_type":"code","source":"fig = px.scatter(train_df, x=\"Physical-Systolic_BP\", y=\"sii\", title=\"Relationship Between Systolic Blood Pressure and sii\", trendline=\"ols\")\nfig.show()\nfig = px.scatter(train_df, x=\"Physical-Diastolic_BP\", y=\"sii\", title=\"Relationship Between Diastolic Blood Pressure and sii\", trendline=\"ols\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:40:26.959458Z","iopub.execute_input":"2024-09-22T10:40:26.959913Z","iopub.status.idle":"2024-09-22T10:40:27.119989Z","shell.execute_reply.started":"2024-09-22T10:40:26.959871Z","shell.execute_reply":"2024-09-22T10:40:27.118555Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 25. Relationship Between Fitness and Endurance Values and sii","metadata":{}},{"cell_type":"code","source":"fig = px.box(train_df, x=\"sii\", y=\"Fitness_Endurance-Max_Stage\", title=\"Relationship Between Max Stage and sii\")\nfig.show()\nfig = px.box(train_df, x=\"sii\", y=\"Fitness_Endurance-Time_Mins\", title=\"Relationship Between Time Mins and sii\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:40:49.934128Z","iopub.execute_input":"2024-09-22T10:40:49.934616Z","iopub.status.idle":"2024-09-22T10:40:50.201330Z","shell.execute_reply.started":"2024-09-22T10:40:49.934570Z","shell.execute_reply":"2024-09-22T10:40:50.200059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 26. Relationship Between FGC Values and sii","metadata":{}},{"cell_type":"code","source":"\nfgc_cols = [col for col in train_df.columns if col.startswith('FGC-FGC_')]\nfor col in fgc_cols:\n    fig = px.box(train_df, x=\"sii\", y=col, title=f\"Relationship Between {col} and sii\")\n    fig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:41:09.508310Z","iopub.execute_input":"2024-09-22T10:41:09.508764Z","iopub.status.idle":"2024-09-22T10:41:10.422531Z","shell.execute_reply.started":"2024-09-22T10:41:09.508721Z","shell.execute_reply":"2024-09-22T10:41:10.421349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 27. Relationship Between BIA Values and sii","metadata":{}},{"cell_type":"code","source":"\nbia_cols = [col for col in train_df.columns if col.startswith('BIA-BIA_')]\nfor col in bia_cols:\n    fig = px.box(train_df, x=\"sii\", y=col, title=f\"Relationship Between {col} and sii\")\n    fig.show()\n","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:41:25.505254Z","iopub.execute_input":"2024-09-22T10:41:25.505753Z","iopub.status.idle":"2024-09-22T10:41:26.547389Z","shell.execute_reply.started":"2024-09-22T10:41:25.505707Z","shell.execute_reply":"2024-09-22T10:41:26.546216Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 28. Relationship Between PAQ Total Values and sii","metadata":{}},{"cell_type":"code","source":"\nfig = px.box(train_df, x=\"sii\", y=\"PAQ_A-PAQ_A_Total\", title=\"Relationship Between PAQ_A_Total and sii\")\nfig.show()\nfig = px.box(train_df, x=\"sii\", y=\"PAQ_C-PAQ_C_Total\", title=\"Relationship Between PAQ_C_Total and sii\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:41:39.519606Z","iopub.execute_input":"2024-09-22T10:41:39.520604Z","iopub.status.idle":"2024-09-22T10:41:39.660383Z","shell.execute_reply.started":"2024-09-22T10:41:39.520548Z","shell.execute_reply":"2024-09-22T10:41:39.659226Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 29. Relationship Between PCIAT Values and sii","metadata":{}},{"cell_type":"code","source":"\npciat_cols = [col for col in train_df.columns if col.startswith('PCIAT-PCIAT_')]\nfor col in pciat_cols:\n    fig = px.box(train_df, x=\"sii\", y=col, title=f\"Relationship Between {col} and sii\")\n    fig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:41:50.186984Z","iopub.execute_input":"2024-09-22T10:41:50.188667Z","iopub.status.idle":"2024-09-22T10:41:51.565351Z","shell.execute_reply.started":"2024-09-22T10:41:50.188610Z","shell.execute_reply":"2024-09-22T10:41:51.564050Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 29. Relationship Between SDS Total Values and sii","metadata":{}},{"cell_type":"code","source":"\nfig = px.box(train_df, x=\"sii\", y=\"SDS-SDS_Total_Raw\", title=\"Relationship Between SDS_Total_Raw and sii\")\nfig.show()\nfig = px.box(train_df, x=\"sii\", y=\"SDS-SDS_Total_T\", title=\"Relationship Between SDS_Total_T and sii\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:42:08.302086Z","iopub.execute_input":"2024-09-22T10:42:08.302572Z","iopub.status.idle":"2024-09-22T10:42:08.439919Z","shell.execute_reply.started":"2024-09-22T10:42:08.302527Z","shell.execute_reply":"2024-09-22T10:42:08.438702Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 29. Relationship Between Daily Computer/Internet Use and sii","metadata":{}},{"cell_type":"code","source":"\nfig = px.scatter(train_df, x=\"PreInt_EduHx-computerinternet_hoursday\", y=\"sii\", title=\"Relationship Between Daily Computer/Internet Use and sii\", trendline=\"ols\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:42:18.140959Z","iopub.execute_input":"2024-09-22T10:42:18.141437Z","iopub.status.idle":"2024-09-22T10:42:18.225371Z","shell.execute_reply.started":"2024-09-22T10:42:18.141392Z","shell.execute_reply":"2024-09-22T10:42:18.223985Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"\n# --- 30. Feature Extraction ---","metadata":{}},{"cell_type":"markdown","source":"# BMI Categories","metadata":{}},{"cell_type":"code","source":"def bmi_categori(bmi):\n    if bmi < 18.5:\n        return \"Underweight\"\n    elif 18.5 <= bmi < 25:\n        return \"Normal\"\n    elif 25 <= bmi < 30:\n        return \"Overweight\"\n    else:\n        return \"Obese\"\n\ntrain_df[\"BMI_Categori\"] = train_df[\"Physical-BMI\"].apply(bmi_categori)","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:43:32.564677Z","iopub.execute_input":"2024-09-22T10:43:32.565137Z","iopub.status.idle":"2024-09-22T10:43:32.575460Z","shell.execute_reply.started":"2024-09-22T10:43:32.565095Z","shell.execute_reply":"2024-09-22T10:43:32.574184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Age Groups","metadata":{}},{"cell_type":"code","source":"def age_group(age):\n    if age < 13:\n        return \"Child\"\n    elif 13 <= age < 18:\n        return \"Adolescent\"\n    else:\n        return \"Young Adult\"\ntrain_df[\"Age_Group\"] = train_df[\"Basic_Demos-Age\"].apply(age_group)","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:44:21.571272Z","iopub.execute_input":"2024-09-22T10:44:21.571769Z","iopub.status.idle":"2024-09-22T10:44:21.581228Z","shell.execute_reply.started":"2024-09-22T10:44:21.571726Z","shell.execute_reply":"2024-09-22T10:44:21.579916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# FGC Z Scores","metadata":{}},{"cell_type":"code","source":"\nfgc_cols = [col for col in train_df.columns if col.startswith('FGC-FGC_')]\nfrom sklearn.preprocessing import StandardScaler # Import StandardScaler for z-score calculation\nscaler = StandardScaler()\ntrain_df[fgc_cols] = scaler.fit_transform(train_df[fgc_cols])","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:44:26.625826Z","iopub.execute_input":"2024-09-22T10:44:26.626280Z","iopub.status.idle":"2024-09-22T10:44:26.696695Z","shell.execute_reply.started":"2024-09-22T10:44:26.626238Z","shell.execute_reply":"2024-09-22T10:44:26.695476Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# BIA Z Scores","metadata":{}},{"cell_type":"code","source":"\nbia_cols = [col for col in train_df.columns if col.startswith('BIA-BIA_')]\nscaler = StandardScaler()\ntrain_df[bia_cols] = scaler.fit_transform(train_df[bia_cols])","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:44:37.334086Z","iopub.execute_input":"2024-09-22T10:44:37.335711Z","iopub.status.idle":"2024-09-22T10:44:37.354839Z","shell.execute_reply.started":"2024-09-22T10:44:37.335617Z","shell.execute_reply":"2024-09-22T10:44:37.353412Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# PCIAT Total Score","metadata":{}},{"cell_type":"code","source":"\npciat_cols = [col for col in train_df.columns if col.startswith('PCIAT-PCIAT_') and col != 'PCIAT-PCIAT_Total']\ntrain_df[\"PCIAT_Total\"] = train_df[pciat_cols].sum(axis=1)","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:47:19.346529Z","iopub.execute_input":"2024-09-22T10:47:19.347008Z","iopub.status.idle":"2024-09-22T10:47:19.357959Z","shell.execute_reply.started":"2024-09-22T10:47:19.346963Z","shell.execute_reply":"2024-09-22T10:47:19.356505Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Total FGC Z Scores:","metadata":{}},{"cell_type":"code","source":"train_df[\"FGC_ZSkor_Total\"] = train_df[fgc_cols].sum(axis=1)","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:45:46.439571Z","iopub.execute_input":"2024-09-22T10:45:46.440071Z","iopub.status.idle":"2024-09-22T10:45:46.452212Z","shell.execute_reply.started":"2024-09-22T10:45:46.440014Z","shell.execute_reply":"2024-09-22T10:45:46.450870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Total BIA Z Scores:","metadata":{}},{"cell_type":"code","source":"\ntrain_df[\"BIA_ZSkor_Total\"] = train_df[bia_cols].sum(axis=1)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Average PCIAT Score:","metadata":{}},{"cell_type":"code","source":"\ntrain_df[\"Avg_PCIAT_Skoru\"] = train_df[\"PCIAT_Total\"] / len(pciat_cols)","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:47:21.509255Z","iopub.execute_input":"2024-09-22T10:47:21.510423Z","iopub.status.idle":"2024-09-22T10:47:21.517702Z","shell.execute_reply.started":"2024-09-22T10:47:21.510363Z","shell.execute_reply":"2024-09-22T10:47:21.516235Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Difference in SDS Total Scores:","metadata":{}},{"cell_type":"code","source":"train_df[\"SDS_ToTal_Diff\"] = train_df[\"SDS-SDS_Total_Raw\"] - train_df[\"SDS-SDS_Total_T\"]","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:47:53.389462Z","iopub.execute_input":"2024-09-22T10:47:53.389971Z","iopub.status.idle":"2024-09-22T10:47:53.397602Z","shell.execute_reply.started":"2024-09-22T10:47:53.389924Z","shell.execute_reply":"2024-09-22T10:47:53.396103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# BMI Category and Age Group Interaction:","metadata":{}},{"cell_type":"code","source":"train_df[\"BMI_Age_Intreaction\"] = train_df[\"BMI_Categori\"] + \"_\" + train_df[\"Age_Group\"]","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:48:54.162574Z","iopub.execute_input":"2024-09-22T10:48:54.163025Z","iopub.status.idle":"2024-09-22T10:48:54.171540Z","shell.execute_reply.started":"2024-09-22T10:48:54.162983Z","shell.execute_reply":"2024-09-22T10:48:54.170095Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df","metadata":{"execution":{"iopub.status.busy":"2024-09-22T10:48:58.766798Z","iopub.execute_input":"2024-09-22T10:48:58.767439Z","iopub.status.idle":"2024-09-22T10:48:58.818885Z","shell.execute_reply.started":"2024-09-22T10:48:58.767388Z","shell.execute_reply":"2024-09-22T10:48:58.817800Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}