{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-08-14T06:34:28.189832Z","iopub.execute_input":"2022-08-14T06:34:28.190317Z","iopub.status.idle":"2022-08-14T06:34:28.198391Z","shell.execute_reply.started":"2022-08-14T06:34:28.190281Z","shell.execute_reply":"2022-08-14T06:34:28.197426Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd\n\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport matplotlib.style\nmatplotlib.style.use('classic')\nimport seaborn as sns\n\nimport warnings\nwarnings.filterwarnings('ignore')\n\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import classification_report\nfrom sklearn import preprocessing\nfrom imblearn.over_sampling import SMOTE\nfrom collections import Counter\nfrom sklearn.experimental import enable_iterative_imputer\nfrom sklearn.impute import IterativeImputer","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:28.597786Z","iopub.execute_input":"2022-08-14T06:34:28.598356Z","iopub.status.idle":"2022-08-14T06:34:28.608652Z","shell.execute_reply.started":"2022-08-14T06:34:28.598321Z","shell.execute_reply":"2022-08-14T06:34:28.607450Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### get the data","metadata":{}},{"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')\nsub = pd.read_csv('../input/tabular-playground-series-aug-2022/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:29.345735Z","iopub.execute_input":"2022-08-14T06:34:29.346802Z","iopub.status.idle":"2022-08-14T06:34:29.469883Z","shell.execute_reply.started":"2022-08-14T06:34:29.346729Z","shell.execute_reply":"2022-08-14T06:34:29.468927Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### EDA","metadata":{}},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:29.862351Z","iopub.execute_input":"2022-08-14T06:34:29.863141Z","iopub.status.idle":"2022-08-14T06:34:29.890781Z","shell.execute_reply.started":"2022-08-14T06:34:29.863081Z","shell.execute_reply":"2022-08-14T06:34:29.889756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:30.032417Z","iopub.execute_input":"2022-08-14T06:34:30.032814Z","iopub.status.idle":"2022-08-14T06:34:30.066160Z","shell.execute_reply.started":"2022-08-14T06:34:30.032755Z","shell.execute_reply":"2022-08-14T06:34:30.065084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:30.184917Z","iopub.execute_input":"2022-08-14T06:34:30.185626Z","iopub.status.idle":"2022-08-14T06:34:30.277015Z","shell.execute_reply.started":"2022-08-14T06:34:30.185587Z","shell.execute_reply":"2022-08-14T06:34:30.275969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:30.364259Z","iopub.execute_input":"2022-08-14T06:34:30.364531Z","iopub.status.idle":"2022-08-14T06:34:30.449276Z","shell.execute_reply.started":"2022-08-14T06:34:30.364504Z","shell.execute_reply":"2022-08-14T06:34:30.448147Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#missing value of train\nsns.heatmap(train.isnull(),yticklabels = False,cbar = False)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:30.510933Z","iopub.execute_input":"2022-08-14T06:34:30.511225Z","iopub.status.idle":"2022-08-14T06:34:31.319772Z","shell.execute_reply.started":"2022-08-14T06:34:30.511198Z","shell.execute_reply":"2022-08-14T06:34:31.318524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#missing value of test\nsns.heatmap(test.isnull(),yticklabels = False,cbar = False)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:31.321852Z","iopub.execute_input":"2022-08-14T06:34:31.322320Z","iopub.status.idle":"2022-08-14T06:34:31.997563Z","shell.execute_reply.started":"2022-08-14T06:34:31.322275Z","shell.execute_reply":"2022-08-14T06:34:31.996649Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Check the number of failures\nfig,ax=plt.subplots()\ntrain['failure'].value_counts().plot.pie(explode=[0,0.1],autopct='%1.1f%%',ax=ax,shadow=True)\nax.set_title('failure')\nax.set_ylabel('')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:31.999178Z","iopub.execute_input":"2022-08-14T06:34:31.999839Z","iopub.status.idle":"2022-08-14T06:34:32.129246Z","shell.execute_reply.started":"2022-08-14T06:34:31.999801Z","shell.execute_reply":"2022-08-14T06:34:32.127947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#check the corr\nfig, ax = plt.subplots(figsize=(12, 12), facecolor='#EAECEE')\ncols = [col for col in train.columns if col not in [\"id\",\"failure\",\"loading\",\"attribute_2\",\"attribute_3\"]]\ndata = train[cols]\ncorr = data.corr()\nmask = np.triu(np.ones_like(corr, dtype=bool))\ncmap = sns.color_palette(\"rainbow\", as_cmap=True)\nsns.heatmap(corr, mask=mask, cmap=cmap, vmax=1, vmin=-1., center=0, annot=False,\n           square=True, linewidths=.5, cbar_kws={\"shrink\": 0.75})","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:32.131565Z","iopub.execute_input":"2022-08-14T06:34:32.132039Z","iopub.status.idle":"2022-08-14T06:34:32.644667Z","shell.execute_reply.started":"2022-08-14T06:34:32.132003Z","shell.execute_reply":"2022-08-14T06:34:32.643684Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.groupby(['product_code','failure'])['failure'].count()\nfig,ax=plt.subplots(1,2,figsize=(18,8))\ntrain[['product_code','failure']].groupby(['product_code']).mean().plot.bar(ax=ax[0])\nax[0].set_title('failure vs product_code')\nsns.countplot('product_code',hue='failure',data=train,ax=ax[1])\nax[1].set_title('product_code:failure vs succeed')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:32.646282Z","iopub.execute_input":"2022-08-14T06:34:32.646992Z","iopub.status.idle":"2022-08-14T06:34:32.998908Z","shell.execute_reply.started":"2022-08-14T06:34:32.646951Z","shell.execute_reply":"2022-08-14T06:34:32.997726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nfig, ax = plt.subplots(3,6)\nfig.set_figheight(15)\nfig.set_figwidth(15)\nfor i in range(18):\n    if i < 6:\n        sns.histplot(x = 'measurement_{}'.format(i),bins = 20,data = train,hue = 'failure',ax = ax[0][i])\n        ax[0][i].set_title('measurement_{}'.format(i))\n    elif i>5 and i<12:\n        sns.histplot(x = 'measurement_{}'.format(i),bins = 20,data = train,hue = 'failure',ax = ax[1][i-6])\n        ax[1][i-6].set_title('measurement_{}'.format(i))\n    else:\n        sns.histplot(x = 'measurement_{}'.format(i),bins = 20,data = train,hue = 'failure',ax = ax[2][i-12])  \n        ax[2][i-12].set_title('measurement_{}'.format(i))\nplt.tight_layout() \nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:33.001404Z","iopub.execute_input":"2022-08-14T06:34:33.001804Z","iopub.status.idle":"2022-08-14T06:34:38.050756Z","shell.execute_reply.started":"2022-08-14T06:34:33.001751Z","shell.execute_reply":"2022-08-14T06:34:38.049685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"f,ax=plt.subplots(1,2,figsize=(15,8))\nsns.violinplot(\"attribute_3\",\"loading\", hue=\"failure\", data=train,split=True,ax=ax[0])\nax[0].set_title('attribute_3 and loading vs failure')\nax[0].set_yticks(range(0,400,20))\nsns.violinplot(\"attribute_2\",\"loading\", hue=\"failure\", data=train,split=True,ax=ax[1])\nax[1].set_title('attribute_2 and loading vs failure')\nax[1].set_yticks(range(0,400,20))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:38.052839Z","iopub.execute_input":"2022-08-14T06:34:38.053507Z","iopub.status.idle":"2022-08-14T06:34:38.688711Z","shell.execute_reply.started":"2022-08-14T06:34:38.053466Z","shell.execute_reply":"2022-08-14T06:34:38.687695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(2,3)\nfig.set_figheight(10)\nfig.set_figwidth(15)\n\nplt1 = sns.histplot(x=\"loading\", data=train,hue=\"failure\",ax=ax[0][0])\nplt2 = sns.histplot(x=\"loading\", kde=True, data=train,hue=\"failure\",ax=ax[0][1])\nplt3 = sns.countplot(x=\"attribute_0\", data=train,hue=\"failure\",ax=ax[0][2])\nplt4 = sns.countplot(x=\"attribute_1\", data=train,hue=\"failure\",ax=ax[1][0])\nplt5 = sns.countplot(x=\"attribute_2\", data=train,hue=\"failure\",ax=ax[1][1])\nplt6 = sns.countplot(x=\"attribute_3\", data=train,hue=\"failure\",ax=ax[1][2])\n\nplt1.set_title(\"loading\")\nplt2.set_title(\"loading\")\nplt3.set_title(\"attribute_0\")\nplt4.set_title(\"attribute_1\")\nplt5.set_title(\"attribute_2\")\nplt6.set_title(\"attribute_3\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:38.690357Z","iopub.execute_input":"2022-08-14T06:34:38.691088Z","iopub.status.idle":"2022-08-14T06:34:40.800635Z","shell.execute_reply.started":"2022-08-14T06:34:38.691043Z","shell.execute_reply":"2022-08-14T06:34:40.799689Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Preprocessing","metadata":{}},{"cell_type":"code","source":"train['attribute_2*3'] = train['attribute_2'] * train['attribute_3']\ntest['attribute_2*3'] = test['attribute_2'] * test['attribute_3']\n\nmeas_gr1_cols = [f\"measurement_{i:d}\" for i in list(range(3, 5)) + list(range(9, 17))]\ntrain['meas_gr1_avg'] = np.mean(train[meas_gr1_cols], axis=1)\ntrain['meas_gr1_std'] = np.std(train[meas_gr1_cols], axis=1)\ntest['meas_gr1_avg'] = np.mean(test[meas_gr1_cols], axis=1)\ntest['meas_gr1_std'] = np.std(test[meas_gr1_cols], axis=1) \n\n#high corr\nmeas_gr2_cols = [f\"measurement_{i:d}\" for i in list(range(5, 9))]\ntrain['meas_gr2_avg'] = np.mean(train[meas_gr2_cols], axis=1)\ntest['meas_gr2_avg'] = np.mean(test[meas_gr2_cols], axis=1)\n\ntrain['meas17/meas_gr2_avg'] = train['measurement_17'] / train['meas_gr2_avg']\ntest['meas17/meas_gr2_avg'] = test['measurement_17'] / test['meas_gr2_avg']","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:40.803043Z","iopub.execute_input":"2022-08-14T06:34:40.803739Z","iopub.status.idle":"2022-08-14T06:34:40.845624Z","shell.execute_reply.started":"2022-08-14T06:34:40.803697Z","shell.execute_reply":"2022-08-14T06:34:40.844663Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Features","metadata":{}},{"cell_type":"code","source":"# numeric features\nfeatures = ['measurement_0', 'measurement_1', 'measurement_2', 'id',\n                   'meas_gr1_avg', 'meas_gr1_std', 'attribute_2*3', 'loading', 'measurement_17', 'meas17/meas_gr2_avg']\n# categorical features\ncategorical_features = [\"product_code\", \"attribute_0\", \"attribute_1\"]\nfeatures.extend(categorical_features)\nfeatures","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:40.951675Z","iopub.execute_input":"2022-08-14T06:34:40.952651Z","iopub.status.idle":"2022-08-14T06:34:40.960881Z","shell.execute_reply.started":"2022-08-14T06:34:40.952603Z","shell.execute_reply":"2022-08-14T06:34:40.959563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Data preparation","metadata":{}},{"cell_type":"code","source":"train_data = train[features]\ntrain_labels = train[\"failure\"]\ntest_data = test[features]\n\n#dummies variable\ntrain_data = pd.get_dummies(train_data, columns = categorical_features)\ntest_data = pd.get_dummies(test_data, columns = categorical_features)\n\nprint(train_data.shape,test_data.shape)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:46.862599Z","iopub.execute_input":"2022-08-14T06:34:46.863204Z","iopub.status.idle":"2022-08-14T06:34:46.900950Z","shell.execute_reply.started":"2022-08-14T06:34:46.863165Z","shell.execute_reply":"2022-08-14T06:34:46.899936Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_drop = [\"product_code_A\", \"product_code_B\", \"product_code_C\",\n                         \"product_code_D\", \"product_code_E\", \"attribute_1_material_8\"]\ntrain_data = train_data.drop(columns = train_drop)\ntest_drop = [\"product_code_F\", \"product_code_G\", \"product_code_H\", \"product_code_I\", \"attribute_1_material_7\"]\ntest_data = test_data.drop(columns = test_drop)\nprint(\"All columns are equal: \", (train_data.columns == test_data.columns).all())","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:50.905876Z","iopub.execute_input":"2022-08-14T06:34:50.906492Z","iopub.status.idle":"2022-08-14T06:34:50.920398Z","shell.execute_reply.started":"2022-08-14T06:34:50.906453Z","shell.execute_reply":"2022-08-14T06:34:50.919206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Handling missing values","metadata":{}},{"cell_type":"code","source":"#IterativeImputer\nmulti_imp = IterativeImputer(max_iter = 9, random_state = 42, verbose = 0,\n                             skip_complete = True, n_nearest_features = 10, tol = 0.001)\nmulti_imp.fit(train_data)\ntransformed_values_train = multi_imp.transform(train_data)\ntransformed_values_test = multi_imp.transform(test_data)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:34:53.864846Z","iopub.execute_input":"2022-08-14T06:34:53.865868Z","iopub.status.idle":"2022-08-14T06:34:53.979368Z","shell.execute_reply.started":"2022-08-14T06:34:53.865822Z","shell.execute_reply":"2022-08-14T06:34:53.978016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Normalizing","metadata":{}},{"cell_type":"code","source":"scaler = preprocessing.StandardScaler()\nscaled_train_data = scaler.fit_transform(transformed_values_train)\nscaled_test_data = scaler.fit_transform(transformed_values_test)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:35:02.651427Z","iopub.execute_input":"2022-08-14T06:35:02.651929Z","iopub.status.idle":"2022-08-14T06:35:02.667851Z","shell.execute_reply.started":"2022-08-14T06:35:02.651884Z","shell.execute_reply":"2022-08-14T06:35:02.666697Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### inbalances dataset","metadata":{}},{"cell_type":"code","source":"print(Counter(train_labels))","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:35:12.714892Z","iopub.execute_input":"2022-08-14T06:35:12.715465Z","iopub.status.idle":"2022-08-14T06:35:12.724775Z","shell.execute_reply.started":"2022-08-14T06:35:12.715427Z","shell.execute_reply":"2022-08-14T06:35:12.723687Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# oversampling by SMOTE\noversample = SMOTE()\nscaled_train_data, train_labels = oversample.fit_resample(scaled_train_data, train_labels)\nscaler = preprocessing.StandardScaler()\nscaled_train_data = scaler.fit_transform(scaled_train_data)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:35:13.084921Z","iopub.execute_input":"2022-08-14T06:35:13.086065Z","iopub.status.idle":"2022-08-14T06:35:13.459935Z","shell.execute_reply.started":"2022-08-14T06:35:13.086018Z","shell.execute_reply":"2022-08-14T06:35:13.458942Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(Counter(train_labels))","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:35:14.606503Z","iopub.execute_input":"2022-08-14T06:35:14.607334Z","iopub.status.idle":"2022-08-14T06:35:14.619366Z","shell.execute_reply.started":"2022-08-14T06:35:14.607286Z","shell.execute_reply":"2022-08-14T06:35:14.618182Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"scaled_train_data","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:37:39.514294Z","iopub.execute_input":"2022-08-14T06:37:39.514684Z","iopub.status.idle":"2022-08-14T06:37:39.522522Z","shell.execute_reply.started":"2022-08-14T06:37:39.514650Z","shell.execute_reply":"2022-08-14T06:37:39.521331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_labels","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:38:05.194169Z","iopub.execute_input":"2022-08-14T06:38:05.194726Z","iopub.status.idle":"2022-08-14T06:38:05.203185Z","shell.execute_reply.started":"2022-08-14T06:38:05.194688Z","shell.execute_reply":"2022-08-14T06:38:05.202220Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### LogisticRegression","metadata":{}},{"cell_type":"code","source":"\n\ntrain_X, val_X, train_Y, val_Y = train_test_split(scaled_train_data, train_labels, \n                                                  test_size=0.05, random_state=42, stratify = train_labels)\nparam_grid = {'C': [ 0.001, 0.01, 0.03, 0.04, 0.05 ,0.06 , 0.1],\n             'penalty':['l2','l1'],\n             'solver': ['lbfgs', 'sag', 'newton-cg', 'liblinear' ]}  \nclassifier = GridSearchCV(LogisticRegression(max_iter = 200), param_grid, cv = 5, verbose = 3) \nclassifier.fit(train_X, train_Y)\nprint(classifier.best_params_)\n\n","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:44:12.890177Z","iopub.execute_input":"2022-08-14T06:44:12.890542Z","iopub.status.idle":"2022-08-14T06:45:04.332877Z","shell.execute_reply.started":"2022-08-14T06:44:12.890510Z","shell.execute_reply":"2022-08-14T06:45:04.331815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\npredicted = classifier.predict(val_X)\nprint(classification_report(val_Y, predicted))\npred_y = classifier.predict_proba(scaled_test_data)[:,1]\n","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:45:12.363700Z","iopub.execute_input":"2022-08-14T06:45:12.364247Z","iopub.status.idle":"2022-08-14T06:45:12.401611Z","shell.execute_reply.started":"2022-08-14T06:45:12.364204Z","shell.execute_reply":"2022-08-14T06:45:12.400773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pred_y","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:45:47.166380Z","iopub.execute_input":"2022-08-14T06:45:47.167020Z","iopub.status.idle":"2022-08-14T06:45:47.176814Z","shell.execute_reply.started":"2022-08-14T06:45:47.166964Z","shell.execute_reply":"2022-08-14T06:45:47.175250Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Random Forest","metadata":{}},{"cell_type":"code","source":"'''\nfrom sklearn.ensemble import RandomForestRegressor\nRFR = RandomForestRegressor(random_state=True)\nRFR.fit(scaled_train_data,train_labels)\nprint('score = ',RFR.score(scaled_train_data,train_labels))\nans_predict_RFR=RFR.predict(scaled_test_data)\n'''\n","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:39:21.558505Z","iopub.execute_input":"2022-08-14T06:39:21.558910Z","iopub.status.idle":"2022-08-14T06:39:55.970492Z","shell.execute_reply.started":"2022-08-14T06:39:21.558873Z","shell.execute_reply":"2022-08-14T06:39:55.969488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ans_predict_RFR","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:40:15.092873Z","iopub.execute_input":"2022-08-14T06:40:15.093406Z","iopub.status.idle":"2022-08-14T06:40:15.103159Z","shell.execute_reply.started":"2022-08-14T06:40:15.093363Z","shell.execute_reply":"2022-08-14T06:40:15.101672Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub = pd.read_csv(\"/kaggle/input/tabular-playground-series-aug-2022/sample_submission.csv\")\nsub.failure = pred_y\n#sub.failure = ans_predict_RFR\nsub.to_csv(\"/kaggle/working/submission.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-14T06:28:43.762663Z","iopub.execute_input":"2022-08-14T06:28:43.763697Z","iopub.status.idle":"2022-08-14T06:28:43.818302Z","shell.execute_reply.started":"2022-08-14T06:28:43.763655Z","shell.execute_reply":"2022-08-14T06:28:43.817404Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}