{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# <h1 style=\"font-family: Trebuchet MS; padding: 12px; font-size: 48px; color: #CD5C5C; text-align: center; line-height: 1.25;\"><b>🏬🔧 Data Pre-processing,<span style=\"color: #40E0D0\"> EDA & Feature Engineering 📉</span></b><br><span style=\"color: #DE3163; font-size: 24px\">Tabular Playground Series  </span></h1>\n<hr>","metadata":{}},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">1. | Introduction 👋</div>\n<center>\n    <img src=\"https://c8.alamy.com/comp/FA4JY9/roundabout-bench-and-table-in-childrens-playground-FA4JY9.jpg\" alt=\"Mart\" width=\"80%\">\n</center>\n<br>","metadata":{}},{"cell_type":"markdown","source":"## <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">Data Set Problems 🤔</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 the Tabular Playground Series is an opportunity to help the fictional company Keep It Dry improve its main product Super Soaker. The product is used in factories to absorb spills and leaks. <br>\n    👉 <mark>We’ll be apply our machine learning skills to predict failure</mark> which allows to optimize in making decisions. <br> \n    👉 <mark><b>Data pre-processing and feature engineering will be performed to prepare the dataset</b></mark> before it is used by the machine learning model.\n</div>\n\n## <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">Objectives of Notebook 📌</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 <b>This notebook aims to:</b>\n    <ul>\n        <li> Perform <mark><b>initial data exploration</b></mark>.</li>\n        <li> Perform <mark><b>data pre-processing</b></mark>.</li>\n        <li> Perform <mark><b>EDA</b></mark> and <mark><b>hypothesis testing (statistical and non-statistical)</b></mark> in cleaned data set.</li>\n        <li> Perform <mark><b>feature engineering (one-hot encoding, label encoding, and binning)</b></mark>.</li>\n    </ul>\n</div>","metadata":{}},{"cell_type":"markdown","source":"## <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">Data Set Description 🧾</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 The dataset contains mainly three files:\n    <ul>\n        <li> <mark><b>train.csv</b></mark> the training data, which includes the target failure</li>\n        <li> <mark><b>test.csv</b></mark>the test set; your task is to predict the likelihood each id will experience a failure</li>\n        <li> <mark><b>sample_submission.csv</b></mark> a sample submission file in the correct format</li>     \n    </ul><br>\n     \n\n**Our task is to use the data to predict individual product failures of new codes with their individual lab test results.**","metadata":{}},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">2. | Importing Libraries 📚</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 <b>Importing libraries</b> that will be used in this notebook.\n</div>","metadata":{}},{"cell_type":"code","source":"# Importing libraries\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport seaborn as sns\nimport matplotlib.pyplot as plt \nimport missingno as mso\nimport plotly.graph_objects as go\nimport plotly.offline as po\nfrom plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\nimport plotly.express as px\nimport random\nimport plotly.figure_factory as ff\nfrom plotly.subplots import make_subplots\nfrom statsmodels.graphics.gofplots import qqplot","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-09T16:18:30.031555Z","iopub.execute_input":"2022-08-09T16:18:30.032832Z","iopub.status.idle":"2022-08-09T16:18:30.145395Z","shell.execute_reply.started":"2022-08-09T16:18:30.032773Z","shell.execute_reply":"2022-08-09T16:18:30.144156Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">3. | Reading Dataset 👓</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 After importing libraries, <b>the dataset that will be used will be imported</b>.\n</div>","metadata":{}},{"cell_type":"code","source":"#Reading the data \ntrain_data= pd.read_csv(\"/kaggle/input/tabular-playground-series-aug-2022/train.csv\")\ntest_data= pd.read_csv(\"/kaggle/input/tabular-playground-series-aug-2022/test.csv\")\n","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:58.300107Z","iopub.execute_input":"2022-08-09T16:12:58.300484Z","iopub.status.idle":"2022-08-09T16:12:58.646537Z","shell.execute_reply.started":"2022-08-09T16:12:58.300451Z","shell.execute_reply":"2022-08-09T16:12:58.645424Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Reading Dataset ---\ntrain_data.head().style.background_gradient(cmap='YlOrBr').set_properties(**{'font-family': 'Segoe UI'}).hide_index()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:58.648477Z","iopub.execute_input":"2022-08-09T16:12:58.648983Z","iopub.status.idle":"2022-08-09T16:12:58.819899Z","shell.execute_reply.started":"2022-08-09T16:12:58.648925Z","shell.execute_reply":"2022-08-09T16:12:58.818465Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data.head().style.background_gradient(cmap='YlOrBr').set_properties(**{'font-family': 'Segoe UI'}).hide_index()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:58.823321Z","iopub.execute_input":"2022-08-09T16:12:58.824666Z","iopub.status.idle":"2022-08-09T16:12:58.915244Z","shell.execute_reply.started":"2022-08-09T16:12:58.824608Z","shell.execute_reply":"2022-08-09T16:12:58.913965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">4. | Color Palettes 🎨</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 This section will create some <b>color palettes</b> that will be used in this notebook.\n</div>","metadata":{}},{"cell_type":"code","source":"# --- Create List of Color Palletes ---\nred_grad = ['#FF0000', '#BF0000', '#800000', '#400000', '#000000']\npink_grad = ['#8A0030', '#BA1141', '#FF5C8A', '#FF99B9', '#FFDEEB']\npurple_grad = ['#4C0028', '#7F0043', '#8E004C', '#A80059', '#C10067']\ncolor_mix = ['#F38BB2', '#FFB9CF', '#FFD7D7', '#F17881', '#E7525B']\nblack_grad = ['#100C07', '#3E3B39', '#6D6A6A', '#9B9A9C', '#CAC9CD']\n\n# --- Plot Color Palletes --\nsns.palplot(red_grad)\nsns.palplot(pink_grad)\nsns.palplot(purple_grad)\nsns.palplot(color_mix)\nsns.palplot(black_grad)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:58.916643Z","iopub.execute_input":"2022-08-09T16:12:58.917058Z","iopub.status.idle":"2022-08-09T16:12:59.654021Z","shell.execute_reply.started":"2022-08-09T16:12:58.917021Z","shell.execute_reply":"2022-08-09T16:12:59.651803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #2E8B57; color: #FFFFFF; padding: 12px; line-height: 1.5;\">5. | Initial Data Exploration 🔍</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 This section will focused on <b>initial data exploration</b> before applying ML models.\n</div>","metadata":{}},{"cell_type":"code","source":"# Shape of the train label data set\n\nprint('\\033[1m'\"Shape of the train label data file\\n\"'\\033[0m',train_data.shape)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:59.657292Z","iopub.execute_input":"2022-08-09T16:12:59.658099Z","iopub.status.idle":"2022-08-09T16:12:59.668937Z","shell.execute_reply.started":"2022-08-09T16:12:59.658026Z","shell.execute_reply":"2022-08-09T16:12:59.666966Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Data Type\nprint('\\033[1m'\"Data types of each column in train label data file\\n\"'\\033[0m',train_data.dtypes)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:59.673401Z","iopub.execute_input":"2022-08-09T16:12:59.675464Z","iopub.status.idle":"2022-08-09T16:12:59.691655Z","shell.execute_reply.started":"2022-08-09T16:12:59.675381Z","shell.execute_reply":"2022-08-09T16:12:59.689388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Plot Missing Values ---\nmso.bar(train_data, fontsize=9, color=[purple_grad[0], purple_grad[0], purple_grad[0], purple_grad[0], purple_grad[0], purple_grad[0],\n                               purple_grad[0], purple_grad[0], purple_grad[0], purple_grad[0], purple_grad[1], purple_grad[1]], \n        figsize=(15, 8), sort='descending', labels=True)\n\n# --- Title & Subtitle Settings ---\nplt.suptitle('Missing Values in each Columns', fontweight='heavy', x=0.124, y=1.22, ha='left',fontsize='16', \n             fontfamily='sans-serif', color=black_grad[0])\nplt.title('Almost all columns have  missing value.\\n\\nThe total of missing values in each column is less than 25%, which means that imputation can still be done to fill in the missing values in the\\ntwo columns.', \n          fontsize='8', fontfamily='sans-serif', loc='left', color=black_grad[1], pad=5)\nplt.grid(axis='both', alpha=0);\n\n# --- Total Missing Values in each Columns ---\nprint('\\033[36m*' * 43)\nprint('\\033[1m'+'.: Total Missing Values in each Columns :.'+'\\033[0m')\nprint('\\033[36m*' * 43+'\\033[0m')\ntrain_data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:23:46.284943Z","iopub.execute_input":"2022-08-09T16:23:46.285586Z","iopub.status.idle":"2022-08-09T16:23:48.908030Z","shell.execute_reply.started":"2022-08-09T16:23:46.285516Z","shell.execute_reply":"2022-08-09T16:23:48.906988Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data=train_data.fillna(train_data.mean())","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:36:15.310605Z","iopub.execute_input":"2022-08-09T16:36:15.311132Z","iopub.status.idle":"2022-08-09T16:36:15.660237Z","shell.execute_reply.started":"2022-08-09T16:36:15.311086Z","shell.execute_reply":"2022-08-09T16:36:15.658957Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #9FE2BF; color: #FFFFFF; padding: 12px; line-height: 1.5;\">5.1 | Univariate Analysis 🔍</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 This section will focused on <b>univariate data analysis</b> before applying ML models.\n</div>","metadata":{}},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #00FF7F; color: #FFFFFF; padding: 12px; line-height: 1.5;\">5.1 | Univariate analysis of Categorical Values 🔍</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 This section will focused on <b>categorical data analysis</b> before applying ML models.\n</div>","metadata":{}},{"cell_type":"code","source":"# --- Setting Colors, Labels, Order ---\ncolors=color_mix[2:4]\nlabels=['0', '1']\norder=train_data['failure'].value_counts().index\n\n# --- Size for Both Figures ---\nplt.figure(figsize=(16, 8))\nplt.suptitle('Failure Distribution', fontweight='heavy', \n             fontsize='16', fontfamily='sans-serif', color=black_grad[0])\n\n# --- Pie Chart ---\nplt.subplot(1, 2, 1)\nplt.title('Pie Chart', fontweight='bold', fontsize=14,\n          fontfamily='sans-serif', color=black_grad[0])\nplt.pie(train_data['failure'].value_counts(), labels=labels, colors=colors, pctdistance=0.7,\n        autopct='%.2f%%', wedgeprops=dict(alpha=0.8, edgecolor=black_grad[1]),\n        textprops={'fontsize':12})\ncentre=plt.Circle((0, 0), 0.45, fc='white', edgecolor=black_grad[1])\nplt.gcf().gca().add_artist(centre)\n\n\n# --- Histogram ---\ncountplt = plt.subplot(1, 2, 2)\nplt.title('Histogram', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[0])\nax = sns.countplot(x='failure', data=train_data, palette=colors, order=order,\n                   edgecolor=black_grad[2], alpha=0.85)\nfor rect in ax.patches:\n    ax.text (rect.get_x()+rect.get_width()/2, \n             rect.get_height()+4.25,rect.get_height(), \n             horizontalalignment='center', fontsize=10, \n             bbox=dict(facecolor='none', edgecolor=black_grad[0], \n                       linewidth=0.25, boxstyle='round'))\n\nplt.xlabel('Failure', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.ylabel('Total', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.xticks([0, 1], labels)\nplt.grid(axis='y', alpha=0.4)\ncountplt\n\n# --- Count Categorical Labels w/out Dropping Null Walues ---\nprint('*' * 25)\nprint('\\033[1m'+'.: Failure Total :.'+'\\033[0m')\nprint('*' * 25)\ntrain_data.failure.value_counts(dropna=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:12:59.694746Z","iopub.execute_input":"2022-08-09T16:12:59.695969Z","iopub.status.idle":"2022-08-09T16:13:00.110949Z","shell.execute_reply.started":"2022-08-09T16:12:59.695885Z","shell.execute_reply":"2022-08-09T16:13:00.109814Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Setting Colors, Labels, Order ---\ncolors=pink_grad[2:4]\nlabels=['C', 'E','B','D','A']\norder=train_data['product_code'].value_counts().index\n\n# --- Size for Both Figures ---\nplt.figure(figsize=(16, 8))\nplt.suptitle('Product Code Distribution', fontweight='heavy', \n             fontsize='16', fontfamily='sans-serif', color=black_grad[0])\n\n# --- Pie Chart ---\nplt.subplot(1, 2, 1)\nplt.title('Pie Chart', fontweight='bold', fontsize=14,\n          fontfamily='sans-serif', color=black_grad[0])\nplt.pie(train_data['product_code'].value_counts(), labels=labels, colors=colors, pctdistance=0.7,\n        autopct='%.2f%%', wedgeprops=dict(alpha=0.8, edgecolor=black_grad[1]),\n        textprops={'fontsize':12})\ncentre=plt.Circle((0, 0), 0.45, fc='white', edgecolor=black_grad[1])\nplt.gcf().gca().add_artist(centre)\n\n# --- Histogram ---\ncountplt = plt.subplot(1, 2, 2)\nplt.title('Histogram', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[0])\nax = sns.countplot(x='product_code', data=train_data, palette=colors, order=order,\n                   edgecolor=black_grad[2], alpha=0.85)\nfor rect in ax.patches:\n    ax.text (rect.get_x()+rect.get_width()/2, \n             rect.get_height()+4.25,rect.get_height(), \n             horizontalalignment='center', fontsize=10, \n             bbox=dict(facecolor='none', edgecolor=black_grad[0], \n                       linewidth=0.25, boxstyle='round'))\n\nplt.xlabel('product_code', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.ylabel('Total', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.xticks([0, 1,2,3,4], labels)\nplt.grid(axis='y', alpha=0.4)\ncountplt\n\n# --- Count Categorical Labels w/out Dropping Null Walues ---\nprint('*' * 25)\nprint('\\033[1m'+'.: Product Code Total :.'+'\\033[0m')\nprint('*' * 25)\ntrain_data.product_code.value_counts(dropna=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:13:00.112746Z","iopub.execute_input":"2022-08-09T16:13:00.113456Z","iopub.status.idle":"2022-08-09T16:13:00.504612Z","shell.execute_reply.started":"2022-08-09T16:13:00.113409Z","shell.execute_reply":"2022-08-09T16:13:00.503329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Setting Colors, Labels, Order ---\ncolors=purple_grad[2:4]\nlabels=['material_7','material_5']\norder=train_data['attribute_0'].value_counts().index\n\n# --- Size for Both Figures ---\nplt.figure(figsize=(16, 8))\nplt.suptitle('Attribute_0 Distribution', fontweight='heavy', \n             fontsize='16', fontfamily='sans-serif', color=black_grad[0])\n\n# --- Pie Chart ---\nplt.subplot(1, 2, 1)\nplt.title('Pie Chart', fontweight='bold', fontsize=14,\n          fontfamily='sans-serif', color=black_grad[0])\nplt.pie(train_data['attribute_0'].value_counts(), labels=labels, colors=colors, pctdistance=0.7,\n        autopct='%.2f%%', wedgeprops=dict(alpha=0.8, edgecolor=black_grad[1]),\n        textprops={'fontsize':12})\ncentre=plt.Circle((0, 0), 0.45, fc='white', edgecolor=black_grad[1])\nplt.gcf().gca().add_artist(centre)\n\n# --- Histogram ---\ncountplt = plt.subplot(1, 2, 2)\nplt.title('Histogram', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[0])\nax = sns.countplot(x='attribute_0', data=train_data, palette=colors, order=order,\n                   edgecolor=black_grad[2], alpha=0.85)\nfor rect in ax.patches:\n    ax.text (rect.get_x()+rect.get_width()/2, \n             rect.get_height()+4.25,rect.get_height(), \n             horizontalalignment='center', fontsize=10, \n             bbox=dict(facecolor='none', edgecolor=black_grad[0], \n                       linewidth=0.25, boxstyle='round'))\n\nplt.xlabel('attribute_0', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.ylabel('Total', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.xticks([0, 1], labels)\nplt.grid(axis='y', alpha=0.4)\ncountplt\n\n# --- Count Categorical Labels w/out Dropping Null Walues ---\nprint('*' * 25)\nprint('\\033[1m'+'.: attribute_0 Total :.'+'\\033[0m')\nprint('*' * 25)\ntrain_data.product_code.value_counts(dropna=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:13:00.508390Z","iopub.execute_input":"2022-08-09T16:13:00.508854Z","iopub.status.idle":"2022-08-09T16:13:00.886261Z","shell.execute_reply.started":"2022-08-09T16:13:00.508806Z","shell.execute_reply":"2022-08-09T16:13:00.884848Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Setting Colors, Labels, Order ---\ncolors=red_grad[2:4]\nlabels=['material_7','material_5','material_6']\norder=train_data['attribute_1'].value_counts().index\n\n# --- Size for Both Figures ---\nplt.figure(figsize=(16, 8))\nplt.suptitle('Attribute_1 Distribution', fontweight='heavy', \n             fontsize='16', fontfamily='sans-serif', color=black_grad[0])\n\n# --- Pie Chart ---\nplt.subplot(1, 2, 1)\nplt.title('Pie Chart', fontweight='bold', fontsize=14,\n          fontfamily='sans-serif', color=black_grad[0])\nplt.pie(train_data['attribute_1'].value_counts(), labels=labels, colors=colors, pctdistance=0.7,\n        autopct='%.2f%%', wedgeprops=dict(alpha=0.8, edgecolor=black_grad[1]),\n        textprops={'fontsize':12})\ncentre=plt.Circle((0, 0), 0.45, fc='white', edgecolor=black_grad[1])\nplt.gcf().gca().add_artist(centre)\n\n# --- Histogram ---\ncountplt = plt.subplot(1, 2, 2)\nplt.title('Histogram', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[0])\nax = sns.countplot(x='attribute_1', data=train_data, palette=colors, order=order,\n                   edgecolor=black_grad[2], alpha=0.85)\nfor rect in ax.patches:\n    ax.text (rect.get_x()+rect.get_width()/2, \n             rect.get_height()+4.25,rect.get_height(), \n             horizontalalignment='center', fontsize=10, \n             bbox=dict(facecolor='none', edgecolor=black_grad[0], \n                       linewidth=0.25, boxstyle='round'))\n\nplt.xlabel('attribute_1', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.ylabel('Total', fontweight='bold', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\nplt.xticks([0, 1,2], labels)\nplt.grid(axis='y', alpha=0.4)\ncountplt\n\n# --- Count Categorical Labels w/out Dropping Null Walues ---\nprint('*' * 25)\nprint('\\033[1m'+'.: attribute_0 Total :.'+'\\033[0m')\nprint('*' * 25)\ntrain_data.product_code.value_counts(dropna=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:13:00.887921Z","iopub.execute_input":"2022-08-09T16:13:00.888862Z","iopub.status.idle":"2022-08-09T16:13:01.257262Z","shell.execute_reply.started":"2022-08-09T16:13:00.888817Z","shell.execute_reply":"2022-08-09T16:13:01.256010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"font-family: Trebuchet MS; background-color: #00FF7F; color: #FFFFFF; padding: 12px; line-height: 1.5;\">5.2 | Univariate analysis of Numerical Values 🔍</div>\n<div style=\"font-family: Segoe UI; line-height: 2; color: #000000; text-align: justify\">\n    👉 This section will focused on <b>Numerical data analysis</b> before applying ML models.\n</div>","metadata":{}},{"cell_type":"code","source":"# --- Descriptive Statistics ---\ntrain_data.select_dtypes(exclude='object').describe().T.style.background_gradient(cmap='PuRd').set_properties(**{'font-family': 'Segoe UI'})","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:13:01.258637Z","iopub.execute_input":"2022-08-09T16:13:01.259031Z","iopub.status.idle":"2022-08-09T16:13:01.401973Z","shell.execute_reply.started":"2022-08-09T16:13:01.258995Z","shell.execute_reply":"2022-08-09T16:13:01.400610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data[\"loading\"].isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:20:44.948950Z","iopub.execute_input":"2022-08-09T16:20:44.949421Z","iopub.status.idle":"2022-08-09T16:20:44.958937Z","shell.execute_reply.started":"2022-08-09T16:20:44.949384Z","shell.execute_reply":"2022-08-09T16:20:44.958047Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'loading'\ncolor = color_mix[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: loading Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('loading Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:42:03.000534Z","iopub.execute_input":"2022-08-09T16:42:03.001052Z","iopub.status.idle":"2022-08-09T16:42:03.994107Z","shell.execute_reply.started":"2022-08-09T16:42:03.001010Z","shell.execute_reply":"2022-08-09T16:42:03.992739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'attribute_2'\ncolor = red_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: loading Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('Attribute 2 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('Attribute 2', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:43:30.104636Z","iopub.execute_input":"2022-08-09T16:43:30.105246Z","iopub.status.idle":"2022-08-09T16:43:30.943212Z","shell.execute_reply.started":"2022-08-09T16:43:30.105194Z","shell.execute_reply":"2022-08-09T16:43:30.941920Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'attribute_3'\ncolor = pink_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: loading Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('Attribute 3 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('Attribute 3', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:43:35.807955Z","iopub.execute_input":"2022-08-09T16:43:35.808386Z","iopub.status.idle":"2022-08-09T16:43:36.645725Z","shell.execute_reply.started":"2022-08-09T16:43:35.808353Z","shell.execute_reply":"2022-08-09T16:43:36.644817Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_0'\ncolor = purple_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_0 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_0 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_0', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:45:08.239037Z","iopub.execute_input":"2022-08-09T16:45:08.239451Z","iopub.status.idle":"2022-08-09T16:45:09.109767Z","shell.execute_reply.started":"2022-08-09T16:45:08.239418Z","shell.execute_reply":"2022-08-09T16:45:09.108266Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_1'\ncolor = color_mix[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_1 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_1 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_1', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:46:09.061849Z","iopub.execute_input":"2022-08-09T16:46:09.062302Z","iopub.status.idle":"2022-08-09T16:46:09.963768Z","shell.execute_reply.started":"2022-08-09T16:46:09.062267Z","shell.execute_reply":"2022-08-09T16:46:09.962386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_2'\ncolor = black_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_2 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_2 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_2', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:47:09.236380Z","iopub.execute_input":"2022-08-09T16:47:09.236945Z","iopub.status.idle":"2022-08-09T16:47:10.164142Z","shell.execute_reply.started":"2022-08-09T16:47:09.236901Z","shell.execute_reply":"2022-08-09T16:47:10.162912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_3'\ncolor = red_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_3 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_3 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_3', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:48:09.256255Z","iopub.execute_input":"2022-08-09T16:48:09.256825Z","iopub.status.idle":"2022-08-09T16:48:10.787059Z","shell.execute_reply.started":"2022-08-09T16:48:09.256771Z","shell.execute_reply":"2022-08-09T16:48:10.785933Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_4'\ncolor = pink_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_4 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_4 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_4', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:48:52.788944Z","iopub.execute_input":"2022-08-09T16:48:52.789362Z","iopub.status.idle":"2022-08-09T16:48:53.698215Z","shell.execute_reply.started":"2022-08-09T16:48:52.789328Z","shell.execute_reply":"2022-08-09T16:48:53.696802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_5'\ncolor = purple_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_5 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_5 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_5', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:49:36.240620Z","iopub.execute_input":"2022-08-09T16:49:36.241157Z","iopub.status.idle":"2022-08-09T16:49:37.170599Z","shell.execute_reply.started":"2022-08-09T16:49:36.241117Z","shell.execute_reply":"2022-08-09T16:49:37.169197Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_6'\ncolor = purple_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_6 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_6 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_6', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:52:01.931435Z","iopub.execute_input":"2022-08-09T16:52:01.931940Z","iopub.status.idle":"2022-08-09T16:52:02.866272Z","shell.execute_reply.started":"2022-08-09T16:52:01.931899Z","shell.execute_reply":"2022-08-09T16:52:02.865227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_7'\ncolor = color_mix[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_7 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_7 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_7', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:52:47.057914Z","iopub.execute_input":"2022-08-09T16:52:47.058376Z","iopub.status.idle":"2022-08-09T16:52:47.988099Z","shell.execute_reply.started":"2022-08-09T16:52:47.058337Z","shell.execute_reply":"2022-08-09T16:52:47.986990Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_8'\ncolor = black_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_8 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_8 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_8', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:53:30.151190Z","iopub.execute_input":"2022-08-09T16:53:30.151674Z","iopub.status.idle":"2022-08-09T16:53:31.085138Z","shell.execute_reply.started":"2022-08-09T16:53:30.151635Z","shell.execute_reply":"2022-08-09T16:53:31.083830Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_9'\ncolor = pink_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_9 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_9 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_9', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:54:10.876775Z","iopub.execute_input":"2022-08-09T16:54:10.878045Z","iopub.status.idle":"2022-08-09T16:54:11.945200Z","shell.execute_reply.started":"2022-08-09T16:54:10.877991Z","shell.execute_reply":"2022-08-09T16:54:11.943616Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# --- Variable, Color & Plot Size ---\nvar = 'measurement_10'\ncolor = purple_grad[0]\nfig=plt.figure(figsize=(12, 12))\n\n# --- Skewness & Kurtosis ---\nprint('\\033[1m'+'.: measurement_10 Column Skewness & Kurtosis :.'+'\\033[0m')\nprint('*' * 40)\nprint('Skewness:'+'\\033[1m {:.3f}'.format(train_data[var].skew(axis = 0, skipna = True)))\nprint('\\033[0m'+'Kurtosis:'+'\\033[1m {:.3f}'.format(train_data[var].kurt(axis = 0, skipna = True)))\nprint('\\n')\n\n# --- General Title ---\nfig.suptitle('measurement_10 Column Distribution', fontweight='bold', fontsize=16, \n             fontfamily='sans-serif', color=black_grad[0])\nfig.subplots_adjust(top=0.9)\n\n# --- Histogram ---\nax_1=fig.add_subplot(2, 2, 2)\nplt.title('Histogram Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nsns.histplot(data=train_data, x=var, kde=True, color=color)\nplt.xlabel('Total', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Loading', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\n# --- Q-Q Plot ---\nax_2=fig.add_subplot(2, 2, 4)\nplt.title('Q-Q Plot', fontweight='bold', fontsize=14, \n          fontfamily='sans-serif', color=black_grad[1])\nqqplot(train_data[var], fit=True, line='45', ax=ax_2, markerfacecolor=color, \n       markeredgecolor=color, alpha=0.6)\nplt.xlabel('Theoritical Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\nplt.ylabel('Sample Quantiles', fontweight='regular', fontsize=11, \n           fontfamily='sans-serif', color=black_grad[1])\n\n# --- Box Plot ---\nax_3=fig.add_subplot(1, 2, 1)\nplt.title('Box Plot', fontweight='bold', fontsize=14, fontfamily='sans-serif', \n          color=black_grad[1])\nsns.boxplot(data=train_data, y=var, color=color, boxprops=dict(alpha=0.8), linewidth=1.5)\nplt.ylabel('measurement_10', fontweight='regular', fontsize=11, fontfamily='sans-serif', \n           color=black_grad[1])\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-09T16:54:53.590235Z","iopub.execute_input":"2022-08-09T16:54:53.590673Z","iopub.status.idle":"2022-08-09T16:54:54.611494Z","shell.execute_reply.started":"2022-08-09T16:54:53.590639Z","shell.execute_reply":"2022-08-09T16:54:54.610202Z"},"trusted":true},"execution_count":null,"outputs":[]}]}