{"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":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"_uuid":"30e1fc01-768e-4ce0-9f7a-1d5d347e42b4","_cell_guid":"9e71dade-0e22-465a-89ea-b0e2856d0e36","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:23:44.601124Z","iopub.execute_input":"2022-08-11T20:23:44.601742Z","iopub.status.idle":"2022-08-11T20:23:45.799489Z","shell.execute_reply.started":"2022-08-11T20:23:44.601616Z","shell.execute_reply":"2022-08-11T20:23:45.798090Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train=pd.read_csv(\"../input/tabular-playground-series-aug-2022/train.csv\")\ntest=pd.read_csv(\"../input/tabular-playground-series-aug-2022/test.csv\")","metadata":{"_uuid":"f8c7b579-77a7-4599-a396-919bea62f35c","_cell_guid":"dee814cb-5a5e-40d9-939e-142ff606f17f","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:23:47.812414Z","iopub.execute_input":"2022-08-11T20:23:47.812877Z","iopub.status.idle":"2022-08-11T20:23:48.084485Z","shell.execute_reply.started":"2022-08-11T20:23:47.812838Z","shell.execute_reply":"2022-08-11T20:23:48.082891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.info()","metadata":{"_uuid":"de4d1574-402f-4962-9af6-c01572032d15","_cell_guid":"000b7841-1675-449f-b390-1469001cb0c8","collapsed":false,"_kg_hide-input":false,"_kg_hide-output":true,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:23:50.202915Z","iopub.execute_input":"2022-08-11T20:23:50.203331Z","iopub.status.idle":"2022-08-11T20:23:50.241568Z","shell.execute_reply.started":"2022-08-11T20:23:50.203290Z","shell.execute_reply":"2022-08-11T20:23:50.240573Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.info()","metadata":{"_uuid":"38a8be77-6043-4a7d-a464-44b9b7452641","_cell_guid":"9b652b13-4868-45fb-8151-7c1deb743109","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:01:53.099628Z","iopub.execute_input":"2022-08-11T20:01:53.100358Z","iopub.status.idle":"2022-08-11T20:01:53.120912Z","shell.execute_reply.started":"2022-08-11T20:01:53.100305Z","shell.execute_reply":"2022-08-11T20:01:53.119289Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# EDA","metadata":{"_uuid":"43252381-e92b-4cfc-931f-f782724cec1b","_cell_guid":"fd310616-72b3-49b3-9992-f732140bd455","_kg_hide-input":false,"trusted":true}},{"cell_type":"code","source":"train.describe().T","metadata":{"_uuid":"788eb21e-4544-4bb0-ba2a-1e74fad68f9f","_cell_guid":"bc21fcc7-6c63-4063-8c12-95cc97936107","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:01:56.581393Z","iopub.execute_input":"2022-08-11T20:01:56.581880Z","iopub.status.idle":"2022-08-11T20:01:56.714311Z","shell.execute_reply.started":"2022-08-11T20:01:56.581842Z","shell.execute_reply":"2022-08-11T20:01:56.712803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.describe().T","metadata":{"_uuid":"e5cb0d59-d003-4181-8d60-568e87063916","_cell_guid":"1fa5c366-f8f8-4c4b-8884-8661354534d7","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:01:57.150246Z","iopub.execute_input":"2022-08-11T20:01:57.150686Z","iopub.status.idle":"2022-08-11T20:01:57.251296Z","shell.execute_reply.started":"2022-08-11T20:01:57.150653Z","shell.execute_reply":"2022-08-11T20:01:57.249898Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Nan Values","metadata":{"_uuid":"7da07ff9-6ba4-4627-bb4f-21ae9fdf4d73","_cell_guid":"1e108a4a-0be1-49bf-80e8-69b24ed71b89","_kg_hide-input":false,"trusted":true}},{"cell_type":"code","source":"cat_cols=[col for col in train.columns if train[col].dtype==\"O\"]\nnum_cols=[col for col in train.columns if train[col].dtype!=\"O\" and col!=\"id\" and col!=\"failure\"]","metadata":{"_uuid":"23456037-b6bf-4c11-96ce-16a231212622","_cell_guid":"ee06cbda-8b2e-4dc1-afef-e9d2d7d8328a","collapsed":false,"_kg_hide-input":false,"_kg_hide-output":true,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:25:50.082481Z","iopub.execute_input":"2022-08-11T20:25:50.082920Z","iopub.status.idle":"2022-08-11T20:25:50.091848Z","shell.execute_reply.started":"2022-08-11T20:25:50.082885Z","shell.execute_reply":"2022-08-11T20:25:50.090368Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat_cols_test=[col for col in test.columns if test[col].dtype==\"O\"]\nnum_cols_test=[col for col in test.columns if test[col].dtype!=\"O\" and col!=\"id\" ]","metadata":{"_uuid":"0d398c61-8737-4c4f-98ac-c8591bbc6e73","_cell_guid":"0b16b7ac-ee18-481c-b76d-8668d49de063","collapsed":false,"jupyter":{"outputs_hidden":false},"_kg_hide-input":false,"execution":{"iopub.status.busy":"2022-08-11T20:25:50.929338Z","iopub.execute_input":"2022-08-11T20:25:50.930246Z","iopub.status.idle":"2022-08-11T20:25:50.937402Z","shell.execute_reply.started":"2022-08-11T20:25:50.930202Z","shell.execute_reply":"2022-08-11T20:25:50.936009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"categorical columns count: {len(cat_cols)}, numerical columns count: {len(num_cols)}\")","metadata":{"_uuid":"94f773d3-8286-4fa8-bfc0-0a724878e96d","_cell_guid":"5a931e90-1bd5-4606-8b70-bf56807ada4d","collapsed":false,"_kg_hide-input":false,"_kg_hide-output":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:25:52.404901Z","iopub.execute_input":"2022-08-11T20:25:52.405325Z","iopub.status.idle":"2022-08-11T20:25:52.410940Z","shell.execute_reply.started":"2022-08-11T20:25:52.405288Z","shell.execute_reply":"2022-08-11T20:25:52.409870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat_cols","metadata":{"_uuid":"0292465a-4601-4819-a3f8-408c448f1b62","_cell_guid":"23c68004-bb58-40c5-ba2a-5479659ba572","collapsed":false,"_kg_hide-input":false,"_kg_hide-output":true,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:06.955189Z","iopub.execute_input":"2022-08-11T20:02:06.955662Z","iopub.status.idle":"2022-08-11T20:02:06.963587Z","shell.execute_reply.started":"2022-08-11T20:02:06.955626Z","shell.execute_reply":"2022-08-11T20:02:06.962624Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def show_na(df):\n    figsize=(12,6)\n    plt.figure(figsize=figsize)\n    sns.heatmap(df.isnull(),yticklabels=False,cbar=False,cmap='viridis')\n    plt.show()\n    print(df.isnull().sum())\nshow_na(train)","metadata":{"_uuid":"5f21cbf6-4872-40ea-b54d-d4a03e7ca2df","_cell_guid":"4a5bd5d8-36e0-495f-b7da-59b611342b0f","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:07.858680Z","iopub.execute_input":"2022-08-11T20:02:07.859356Z","iopub.status.idle":"2022-08-11T20:02:08.855061Z","shell.execute_reply.started":"2022-08-11T20:02:07.859319Z","shell.execute_reply":"2022-08-11T20:02:08.853875Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"show_na(test)","metadata":{"_uuid":"034740fb-1520-466f-962b-9ec696d9bba5","_cell_guid":"f4bac82c-72b9-47c5-aa36-91a10e446c22","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:14.907919Z","iopub.execute_input":"2022-08-11T20:02:14.908313Z","iopub.status.idle":"2022-08-11T20:02:15.703188Z","shell.execute_reply.started":"2022-08-11T20:02:14.908281Z","shell.execute_reply":"2022-08-11T20:02:15.701564Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import display","metadata":{"_uuid":"0571d314-b8e7-43fd-94d0-ddeac8acd064","_cell_guid":"f4f1b9c1-037b-4b2a-93aa-a18913dcac94","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:19.390625Z","iopub.execute_input":"2022-08-11T20:02:19.391046Z","iopub.status.idle":"2022-08-11T20:02:19.397202Z","shell.execute_reply.started":"2022-08-11T20:02:19.391012Z","shell.execute_reply":"2022-08-11T20:02:19.395741Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset=pd.concat([train.drop(\"failure\",axis=1),test],axis=0)","metadata":{"_uuid":"2a48a789-6485-4351-b3e3-ec644d6f0a39","_cell_guid":"f7469ef6-3167-46d5-82fe-383aaba56843","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:35.374999Z","iopub.execute_input":"2022-08-11T20:02:35.376200Z","iopub.status.idle":"2022-08-11T20:02:35.397827Z","shell.execute_reply.started":"2022-08-11T20:02:35.376154Z","shell.execute_reply":"2022-08-11T20:02:35.396896Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.head(3)","metadata":{"_uuid":"530bb25c-9520-4622-a913-9d3c5a5ee9ff","_cell_guid":"6da97eae-ab5c-4164-8deb-593c7f4f521e","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:04:52.564153Z","iopub.execute_input":"2022-08-11T20:04:52.564569Z","iopub.status.idle":"2022-08-11T20:04:52.596038Z","shell.execute_reply.started":"2022-08-11T20:04:52.564536Z","shell.execute_reply":"2022-08-11T20:04:52.594600Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def df_highlight(df,cols,stat):\n    for col in cat_cols:\n        A=df[cols].copy()\n        if stat==\"mean\":\n            A=A.groupby(col).mean()\n        elif stat==\"std\":\n            A=A.groupby(col).std()\n        elif stat==\"count\":\n            A=A.groupby(col).count()\n        elif stat==\"median\":\n            A=A.groupby(col).median()\n        else :\n            A=A.groupby(col).count()\n        display(A.sort_values(A.columns[0]).style.bar(subset=[A.columns[0]]\n                                                             ).background_gradient(\n                                                                                    cmap=\"viridis_r\"\n                                                                ))","metadata":{"_uuid":"00e6bf66-3b7e-490f-b9d8-bd11418090b4","_cell_guid":"1ec86e7a-1225-4f46-b9a8-47671b6f998d","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:36.263118Z","iopub.execute_input":"2022-08-11T20:02:36.263940Z","iopub.status.idle":"2022-08-11T20:02:36.273642Z","shell.execute_reply.started":"2022-08-11T20:02:36.263899Z","shell.execute_reply":"2022-08-11T20:02:36.271808Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.isnull().sum()[dataset.isnull().sum()==0]","metadata":{"_uuid":"a1ed2c28-dc9e-484c-8990-3a57b769a039","_cell_guid":"5f8b5ee0-767c-4ef1-9c21-ce9307ee1701","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:39.735476Z","iopub.execute_input":"2022-08-11T20:02:39.735985Z","iopub.status.idle":"2022-08-11T20:02:39.767229Z","shell.execute_reply.started":"2022-08-11T20:02:39.735947Z","shell.execute_reply":"2022-08-11T20:02:39.765927Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dataset.isnull().sum()[dataset.isnull().sum()==0].keys()","metadata":{"_uuid":"81b20da0-596a-410f-a07f-d3b54fc069e8","_cell_guid":"aa3e211c-9b22-478d-8d14-76e3717ca634","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:41.127169Z","iopub.execute_input":"2022-08-11T20:02:41.127554Z","iopub.status.idle":"2022-08-11T20:02:41.157040Z","shell.execute_reply.started":"2022-08-11T20:02:41.127524Z","shell.execute_reply":"2022-08-11T20:02:41.156043Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_highlight(dataset,['product_code', 'attribute_0', 'attribute_1', 'attribute_2',\n       'attribute_3', 'measurement_0', 'measurement_1', 'measurement_2'],\"mean\")","metadata":{"_uuid":"bdc6406c-fdf8-4896-86cf-682db810667b","_cell_guid":"4e580e1e-6513-41ad-ba22-b5bb3c8db252","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:02:43.519949Z","iopub.execute_input":"2022-08-11T20:02:43.520626Z","iopub.status.idle":"2022-08-11T20:02:43.684828Z","shell.execute_reply.started":"2022-08-11T20:02:43.520579Z","shell.execute_reply":"2022-08-11T20:02:43.683576Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_highlight(train,[\"failure\",'product_code', 'attribute_0', 'attribute_1', 'attribute_2',\n       'attribute_3', 'measurement_0', 'measurement_1', 'measurement_2'],\"mean\")","metadata":{"_uuid":"a69c1e38-f505-4dad-8dec-f58b458047fe","_cell_guid":"50215a0d-10a1-4309-81a0-b7e651523d01","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:03:02.054356Z","iopub.execute_input":"2022-08-11T20:03:02.054854Z","iopub.status.idle":"2022-08-11T20:03:02.147425Z","shell.execute_reply.started":"2022-08-11T20:03:02.054813Z","shell.execute_reply":"2022-08-11T20:03:02.146055Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,15))\nsns.heatmap(train.corr(),annot=True,fmt=\".1g\")","metadata":{"_uuid":"8361a4c4-cdc0-4af8-90cc-07fd8166222f","_cell_guid":"1f47a22b-689f-4c09-a77f-f313223806ad","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:03:17.219496Z","iopub.execute_input":"2022-08-11T20:03:17.221004Z","iopub.status.idle":"2022-08-11T20:03:19.910152Z","shell.execute_reply.started":"2022-08-11T20:03:17.220941Z","shell.execute_reply":"2022-08-11T20:03:19.908414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20,15))\nsns.heatmap(test.corr(),annot=True,fmt=\".1g\")","metadata":{"_uuid":"192666c3-2d4b-469d-9fc7-163a62e39e8e","_cell_guid":"a4235387-71cf-4707-9bb2-e04e3ff2566e","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:03:19.912304Z","iopub.execute_input":"2022-08-11T20:03:19.912664Z","iopub.status.idle":"2022-08-11T20:03:22.709830Z","shell.execute_reply.started":"2022-08-11T20:03:19.912633Z","shell.execute_reply":"2022-08-11T20:03:22.708057Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat_cols","metadata":{"_uuid":"00bb976d-a7c1-46ed-8b73-f575df0e628f","_cell_guid":"11edd59d-0e7b-4844-95b5-f94bb5f49b35","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:03:41.614817Z","iopub.execute_input":"2022-08-11T20:03:41.615210Z","iopub.status.idle":"2022-08-11T20:03:41.623214Z","shell.execute_reply.started":"2022-08-11T20:03:41.615178Z","shell.execute_reply":"2022-08-11T20:03:41.622099Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.nunique().sort_values()","metadata":{"_uuid":"b0c7ff12-39f1-417f-823c-5594092c83e0","_cell_guid":"8f25d01f-9fff-4c41-8b35-30751b7940fa","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:03:59.274943Z","iopub.execute_input":"2022-08-11T20:03:59.275408Z","iopub.status.idle":"2022-08-11T20:03:59.320809Z","shell.execute_reply.started":"2022-08-11T20:03:59.275375Z","shell.execute_reply":"2022-08-11T20:03:59.319681Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.nunique().sort_values()","metadata":{"_uuid":"0aea37f6-8570-4ef9-b8dc-c0cf6ec5c7d5","_cell_guid":"402ab474-8000-4a0f-9944-ebde130af431","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:04:20.153365Z","iopub.execute_input":"2022-08-11T20:04:20.153776Z","iopub.status.idle":"2022-08-11T20:04:20.186591Z","shell.execute_reply.started":"2022-08-11T20:04:20.153742Z","shell.execute_reply":"2022-08-11T20:04:20.184283Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def distplots(df=train):\n    fig,axs = plt.subplots(ncols=6,nrows=5,figsize=(20,20))\n    plt.subplots_adjust(wspace=0.5,hspace=0.5)\n    for col,ax in zip(df.columns,axs.flat):\n        A=df[col].copy()\n\n        sns.histplot(data=A,ax=ax,stat=\"density\")\n\n        ax.set_title(col)\n    fig.suptitle(\"dist plots\")\n    fig.tight_layout()","metadata":{"_uuid":"6ae34f9c-436b-42c9-994c-43a4d578d381","_cell_guid":"9f29d8e6-5065-48a5-ac12-36f284443ce4","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:05:03.692300Z","iopub.execute_input":"2022-08-11T20:05:03.692741Z","iopub.status.idle":"2022-08-11T20:05:03.701425Z","shell.execute_reply.started":"2022-08-11T20:05:03.692691Z","shell.execute_reply":"2022-08-11T20:05:03.700002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"distplots(df=train)","metadata":{"_uuid":"6a94b8c3-8134-41dc-a33f-47e6f937bf73","_cell_guid":"f8d8dcdd-66a8-4ceb-a86c-af21e6bf49be","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:05:04.349579Z","iopub.execute_input":"2022-08-11T20:05:04.351357Z","iopub.status.idle":"2022-08-11T20:05:14.199759Z","shell.execute_reply.started":"2022-08-11T20:05:04.351310Z","shell.execute_reply":"2022-08-11T20:05:14.195129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat_cols_test","metadata":{"_uuid":"30838204-e1b0-4b89-bdf4-b37c098beadc","_cell_guid":"0c50ecc2-d788-4883-8167-134ae0f70a94","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:05:14.226760Z","iopub.execute_input":"2022-08-11T20:05:14.227366Z","iopub.status.idle":"2022-08-11T20:05:14.240799Z","shell.execute_reply.started":"2022-08-11T20:05:14.227316Z","shell.execute_reply":"2022-08-11T20:05:14.239683Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.attribute_1.unique()","metadata":{"_uuid":"1dc92c9e-5a48-43e7-a582-746a7df7e19e","_cell_guid":"74a06bdc-49f5-4060-920f-be0477721522","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:06:00.588278Z","iopub.execute_input":"2022-08-11T20:06:00.588786Z","iopub.status.idle":"2022-08-11T20:06:00.600802Z","shell.execute_reply.started":"2022-08-11T20:06:00.588745Z","shell.execute_reply":"2022-08-11T20:06:00.598817Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"distplots(df=test)","metadata":{"_uuid":"f9953202-77bd-4b4e-b12a-2aa58d22c494","_cell_guid":"6fd70439-0779-4557-969a-04a19175e9dd","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:06:06.250390Z","iopub.execute_input":"2022-08-11T20:06:06.250860Z","iopub.status.idle":"2022-08-11T20:06:14.691588Z","shell.execute_reply.started":"2022-08-11T20:06:06.250823Z","shell.execute_reply":"2022-08-11T20:06:14.689551Z"},"_kg_hide-input":false,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Cat Column Plots","metadata":{"_uuid":"79494625-7d85-4851-993f-f85987f5277d","_cell_guid":"7b499e1d-098f-4096-892a-ee1dc91887d2","_kg_hide-input":false,"trusted":true}},{"cell_type":"code","source":"fig,axs=plt.subplots(ncols=5,nrows=5,figsize=(18,24))\nplt.subplots_adjust(top=0.1,bottom=0.,wspace=0.3,hspace=0.5)\nfor i,ax in enumerate(axs.flat):\n    try:\n        cols=list(train.columns)\n        cols.remove(\"id\")\n        col=cols[i]\n        sns.stripplot(data=train,x='failure',y=col,ax=ax)\n        ax.set_title(f\"failure vs {col}\");\n    except: pass\nfig.suptitle(\"train vs failure\")\nplt.tight_layout(pad=2)\nplt.show()","metadata":{"_uuid":"a4df4276-0a6b-4bc6-83d0-fdc0b42d1a1d","_cell_guid":"bd757643-ef92-4eb8-bd6b-1e311bfbcce6","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:06:15.496739Z","iopub.execute_input":"2022-08-11T20:06:15.497260Z","iopub.status.idle":"2022-08-11T20:06:22.652589Z","shell.execute_reply.started":"2022-08-11T20:06:15.497220Z","shell.execute_reply":"2022-08-11T20:06:22.651118Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat_cols","metadata":{"_uuid":"6b0015a8-177f-41a5-8e35-cd8e4f840dd5","_cell_guid":"0fb3b2e3-0f9c-49be-9480-b34286b747b7","collapsed":false,"jupyter":{"outputs_hidden":false},"_kg_hide-input":false,"execution":{"iopub.status.busy":"2022-08-11T20:24:36.094876Z","iopub.execute_input":"2022-08-11T20:24:36.095487Z","iopub.status.idle":"2022-08-11T20:24:36.103756Z","shell.execute_reply.started":"2022-08-11T20:24:36.095449Z","shell.execute_reply":"2022-08-11T20:24:36.102626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig,axs=plt.subplots(ncols=8,nrows=6,figsize=(24,20))\nplt.subplots_adjust(top=0.1,bottom=0.,wspace=0.3,hspace=0.5)\n\nfor i,ax in enumerate(axs.flat):\n    try:\n        \n        \n        if i%2==0:\n\n            col=num_cols[int(np.floor(i/2))]\n\n            sns.stripplot(data=train,x='product_code',y=col, hue=\"failure\",ax=ax)\n            ax.set_title(f\"p_code vs {col}\");\n        else:\n            col=num_cols[int(np.floor((i-1)/2))]\n            sns.stripplot(data=test,x='product_code',y=col,ax=ax,palette=\"gray\")\n        \n            ax.set_title(f\"p_codeT vs {col}\");\n    except:pass\nfig.suptitle(\"Numerical columns vs product_code\")\nplt.tight_layout(pad=2)\nplt.show()","metadata":{"_uuid":"73ae94e6-ee7c-4236-bf33-48a8f8d14bf8","_cell_guid":"0aba3d43-075d-48a5-9cf1-42ccc6872a2f","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:06:31.814937Z","iopub.execute_input":"2022-08-11T20:06:31.815367Z","iopub.status.idle":"2022-08-11T20:07:06.403223Z","shell.execute_reply.started":"2022-08-11T20:06:31.815332Z","shell.execute_reply":"2022-08-11T20:07:06.401130Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-11T20:15:12.008451Z","iopub.execute_input":"2022-08-11T20:15:12.008997Z","iopub.status.idle":"2022-08-11T20:15:12.045493Z","shell.execute_reply.started":"2022-08-11T20:15:12.008954Z","shell.execute_reply":"2022-08-11T20:15:12.044291Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig,axs=plt.subplots(ncols=8,nrows=6,figsize=(24,20))\nplt.subplots_adjust(top=0.1,bottom=0.,wspace=0.3,hspace=0.5)\n\nfor i,ax in enumerate(axs.flat):\n    try:\n        \n        \n        if i%2==0:\n\n            col=num_cols[int(np.floor(i/2))]\n\n            sns.stripplot(data=train,x='attribute_0',y=col, hue=\"failure\",ax=ax)\n            ax.set_title(f\"attribute_0 vs {col}\");\n        else:\n            col=num_cols[int(np.floor((i-1)/2))]\n            sns.stripplot(data=test,x='attribute_0',y=col,ax=ax,palette=\"gray\")\n        \n            ax.set_title(f\"attribute_0T vs {col}\");\n    except:pass\nfig.suptitle(\"Numerical columns vs attribute_0\")\nplt.tight_layout(pad=2)\nplt.show()","metadata":{"_uuid":"d2bcf957-c982-4d02-891e-4b678e5d58d6","_cell_guid":"2f4c5795-ce03-4b16-a01d-968234d5b974","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:07:06.407164Z","iopub.execute_input":"2022-08-11T20:07:06.408671Z","iopub.status.idle":"2022-08-11T20:07:36.353009Z","shell.execute_reply.started":"2022-08-11T20:07:06.408602Z","shell.execute_reply":"2022-08-11T20:07:36.351102Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig,axs=plt.subplots(ncols=8,nrows=6,figsize=(24,20))\nplt.subplots_adjust(top=0.1,bottom=0.,wspace=0.3,hspace=0.5)\n\nfor i,ax in enumerate(axs.flat):\n    try:\n        \n        \n        if i%2==0:\n\n            col=num_cols[int(np.floor(i/2))]\n\n            sns.stripplot(data=train,x='attribute_1',y=col, hue=\"failure\",ax=ax)\n            ax.set_title(f\"attribute_1 vs {col}\");\n        else:\n            col=num_cols[int(np.floor((i-1)/2))]\n            sns.stripplot(data=test,x='attribute_1',y=col,ax=ax,palette=\"gray\")\n        \n            ax.set_title(f\"attribute_1T vs {col}\");\n    except:pass\nfig.suptitle(\"Numerical columns vs attribute_1\")\nplt.tight_layout(pad=2)\nplt.show()","metadata":{"_uuid":"122521bb-4672-4dd8-a48c-dc9406a2a86d","_cell_guid":"f8abf2a1-9e36-472b-b829-6c7ae6c36a05","collapsed":false,"_kg_hide-input":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-08-11T20:07:36.355340Z","iopub.execute_input":"2022-08-11T20:07:36.355831Z","iopub.status.idle":"2022-08-11T20:08:10.665368Z","shell.execute_reply.started":"2022-08-11T20:07:36.355785Z","shell.execute_reply":"2022-08-11T20:08:10.663151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"...","metadata":{"_uuid":"e8944ef5-2e36-4875-8fbf-0e840ff26bd4","_cell_guid":"40df0556-3f0f-4aee-9dc8-1213ec4425ed","_kg_hide-input":false,"trusted":true}}]}