{"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 pandas as pd\nimport numpy as np","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-11T18:01:35.952928Z","iopub.execute_input":"2022-08-11T18:01:35.953398Z","iopub.status.idle":"2022-08-11T18:01:35.958221Z","shell.execute_reply.started":"2022-08-11T18:01:35.953364Z","shell.execute_reply":"2022-08-11T18:01:35.957319Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv('../input/tabular-playground-series-aug-2022/train.csv')\ntrain.drop('failure',axis=1, inplace = True)\ntrain.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:01:36.511532Z","iopub.execute_input":"2022-08-11T18:01:36.512350Z","iopub.status.idle":"2022-08-11T18:01:36.635614Z","shell.execute_reply.started":"2022-08-11T18:01:36.512292Z","shell.execute_reply":"2022-08-11T18:01:36.634287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Kaggle's description:\n\nHelp the fictional company Keep It Dry improve its main product Super Soaker. The product is used in factories to absorb spills and leaks. Each product is used in a simulated real-world environment experiment, and and absorbs a certain amount of fluid (loading) to see whether or not it fails.\n\n### From @purist1024's topic:\nSo our client has hired us to help them evaluate potential new products and determine whether they’ll be profitable. (They don’t say that outright, but it’s always about the profit.) In this case, though they undoubtedly call them something like “premium absorptive pads”, what they are selling are high-tech sponges. We want to know if these sponges will keep on absorbing, even when already saturated (i.e. at high loading values).\n\n### From @desalegngeb's topic:\nMultiply length dimensions to get area. `attribute_2` and `attribute_3` look like they are width and length dimensions or similar.\n\n## I wanted to try and dig deeper on the product codes: \n## measurement_5's z-score > 0 (more probability to be failure)\n## Let's assume for now that this is a good indication of failure","metadata":{}},{"cell_type":"code","source":"train['m5_missing'] = train['measurement_5'].isnull().astype(np.int8) # First we grab the missing values","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:01:37.757954Z","iopub.execute_input":"2022-08-11T18:01:37.758405Z","iopub.status.idle":"2022-08-11T18:01:37.765990Z","shell.execute_reply.started":"2022-08-11T18:01:37.758371Z","shell.execute_reply":"2022-08-11T18:01:37.765071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Create m5 list that contains index of all missing values\nm5_list = [i for i, value in enumerate(train['m5_missing']) if value == 1]\n\n                          # attribute_2 * attribute_3\n                          # Feature `attribute_2*3` VV\ncodeA = train[train[\"product_code\"] == 'A'] # 9x5 = 45        (A value_counts = 5100)\ncodeB = train[train[\"product_code\"] == 'B'] # 8x8 = 64        (B value_counts = 5250)\ncodeC = train[train[\"product_code\"] == 'C'] # 5x8 = 40        (C value_counts = 5765)\ncodeD = train[train[\"product_code\"] == 'D'] # 6x6 = 36        (D value_counts = 5112)\ncodeE = train[train[\"product_code\"] == 'E'] # 6x9 = 54        (E value_counts = 5343)\n\ntrain[\"product_code\"][m5_list].value_counts() # Product code value counts where measurement_5 is missing","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:01:38.979497Z","iopub.execute_input":"2022-08-11T18:01:38.979875Z","iopub.status.idle":"2022-08-11T18:01:39.016583Z","shell.execute_reply.started":"2022-08-11T18:01:38.979843Z","shell.execute_reply":"2022-08-11T18:01:39.015333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## measurement_5 is missing less values in product code B and D compared to others\n## This begs the question, if these really are width and height dimensions, do cube sponges perform better than the other non-cubic shapes?","metadata":{}},{"cell_type":"code","source":"train[\"product_code\"].value_counts() # Total train product code value counts - seen above","metadata":{"execution":{"iopub.status.busy":"2022-08-11T18:01:40.810292Z","iopub.execute_input":"2022-08-11T18:01:40.810803Z","iopub.status.idle":"2022-08-11T18:01:40.823537Z","shell.execute_reply.started":"2022-08-11T18:01:40.810762Z","shell.execute_reply":"2022-08-11T18:01:40.822361Z"},"trusted":true},"execution_count":null,"outputs":[]}]}