{"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 cudf\nimport cupy as cp\nimport dask_cudf\nimport os\nimport numpy as np\nfrom collections import OrderedDict\nimport gc\nfrom glob import glob\nfrom sklearn.metrics import roc_auc_score,confusion_matrix,accuracy_score,classification_report,roc_curve\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import LabelEncoder\nfrom timeit import default_timer\nimport matplotlib.pyplot as plt\nimport pickle\nimport xgboost as xgb\nfrom dask.distributed import Client\nclient = Client(n_workers=4, threads_per_worker=4, memory_limit='15GB')\nclient","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-28T18:31:57.602948Z","iopub.execute_input":"2022-07-28T18:31:57.603329Z","iopub.status.idle":"2022-07-28T18:32:05.345158Z","shell.execute_reply.started":"2022-07-28T18:31:57.603302Z","shell.execute_reply":"2022-07-28T18:32:05.343916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#selected_columns=['customer_ID','S_2','B_30', 'B_38', 'D_114', 'D_116', 'D_117', 'D_120', 'D_126', 'D_66', 'D_68']","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:32:05.350024Z","iopub.execute_input":"2022-07-28T18:32:05.350690Z","iopub.status.idle":"2022-07-28T18:32:05.357233Z","shell.execute_reply.started":"2022-07-28T18:32:05.350647Z","shell.execute_reply":"2022-07-28T18:32:05.355831Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf=dask_cudf.read_csv('../input/amex-default-prediction/train_data.csv', usecols=selected_columns, dtypes={''#['B_30', 'B_38', 'D_114', 'D_116', 'D_117', 'D_120', 'D_126', 'D_63', 'D_64', 'D_66', 'D_68'])","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:32:05.358914Z","iopub.execute_input":"2022-07-28T18:32:05.359532Z","iopub.status.idle":"2022-07-28T18:32:05.366875Z","shell.execute_reply.started":"2022-07-28T18:32:05.359423Z","shell.execute_reply":"2022-07-28T18:32:05.365894Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n\ncdf=dask_cudf.read_csv('../input/amex-default-prediction/train_data.csv')#,dtype={'customer_ID':str,'S_2':'datetime64[ns]','B_30':int, 'B_38':int, 'D_114':int, 'D_116':int, 'D_117':int, 'D_120':int, 'D_126':int, 'D_66':int, 'D_68':int})","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:32:05.370387Z","iopub.execute_input":"2022-07-28T18:32:05.371012Z","iopub.status.idle":"2022-07-28T18:32:07.632533Z","shell.execute_reply.started":"2022-07-28T18:32:05.370978Z","shell.execute_reply":"2022-07-28T18:32:07.631531Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ncdf1=cdf.drop_duplicates('customer_ID',keep='last').reset_index(drop=True)\n#cdf1=cdf.drop_duplicates('customer_ID')#.compute()\ncdf2=cdf1.drop(['customer_ID','S_2','D_63','D_64'],axis=1)\n#cdf3=cdf2.drop(, axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:40:26.623814Z","iopub.execute_input":"2022-07-28T18:40:26.624792Z","iopub.status.idle":"2022-07-28T18:40:26.760360Z","shell.execute_reply.started":"2022-07-28T18:40:26.624746Z","shell.execute_reply":"2022-07-28T18:40:26.758742Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nX=cdf2.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:40:29.204136Z","iopub.execute_input":"2022-07-28T18:40:29.205222Z","iopub.status.idle":"2022-07-28T18:41:44.744908Z","shell.execute_reply.started":"2022-07-28T18:40:29.205177Z","shell.execute_reply":"2022-07-28T18:41:44.743263Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"XX=cudf.read_csv('../input/fork-of-one-hot-encoding-d-63-d-64-v3/d_64_D_63_hot.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:25:56.037629Z","iopub.execute_input":"2022-07-28T19:25:56.038125Z","iopub.status.idle":"2022-07-28T19:25:56.235897Z","shell.execute_reply.started":"2022-07-28T19:25:56.038065Z","shell.execute_reply":"2022-07-28T19:25:56.234901Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"XX.drop('Unnamed: 0',inplace=True, axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:03.871944Z","iopub.execute_input":"2022-07-28T19:26:03.873317Z","iopub.status.idle":"2022-07-28T19:26:03.884851Z","shell.execute_reply.started":"2022-07-28T19:26:03.873269Z","shell.execute_reply":"2022-07-28T19:26:03.882802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#X.to_csv('X.csv',index=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:37.602696Z","iopub.execute_input":"2022-07-28T18:33:37.603134Z","iopub.status.idle":"2022-07-28T18:33:37.613920Z","shell.execute_reply.started":"2022-07-28T18:33:37.603095Z","shell.execute_reply":"2022-07-28T18:33:37.612648Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X=cudf.concat([X,XX],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:17.267157Z","iopub.execute_input":"2022-07-28T19:26:17.267529Z","iopub.status.idle":"2022-07-28T19:26:17.278681Z","shell.execute_reply.started":"2022-07-28T19:26:17.267497Z","shell.execute_reply":"2022-07-28T19:26:17.277643Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y=pd.read_csv('../input/amex-default-prediction/train_labels.csv')\n","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:37.858133Z","iopub.execute_input":"2022-07-28T18:33:37.858977Z","iopub.status.idle":"2022-07-28T18:33:38.841176Z","shell.execute_reply.started":"2022-07-28T18:33:37.858936Z","shell.execute_reply":"2022-07-28T18:33:38.839305Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Y=y['target']","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:38.843831Z","iopub.execute_input":"2022-07-28T18:33:38.844453Z","iopub.status.idle":"2022-07-28T18:33:38.852955Z","shell.execute_reply.started":"2022-07-28T18:33:38.844413Z","shell.execute_reply":"2022-07-28T18:33:38.851888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=X.to_pandas()","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:23.108896Z","iopub.execute_input":"2022-07-28T19:26:23.109239Z","iopub.status.idle":"2022-07-28T19:26:24.520707Z","shell.execute_reply.started":"2022-07-28T19:26:23.109212Z","shell.execute_reply":"2022-07-28T19:26:24.519528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nX_train,X_test,y_train,y_test= train_test_split(df,Y, test_size=0.2, stratify=Y)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:26.291475Z","iopub.execute_input":"2022-07-28T19:26:26.291896Z","iopub.status.idle":"2022-07-28T19:26:27.239090Z","shell.execute_reply.started":"2022-07-28T19:26:26.291818Z","shell.execute_reply":"2022-07-28T19:26:27.238094Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#X_train.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:42.369606Z","iopub.execute_input":"2022-07-28T18:33:42.369960Z","iopub.status.idle":"2022-07-28T18:33:42.375988Z","shell.execute_reply.started":"2022-07-28T18:33:42.369924Z","shell.execute_reply":"2022-07-28T18:33:42.374923Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#y_train.shape\n","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:42.377733Z","iopub.execute_input":"2022-07-28T18:33:42.378097Z","iopub.status.idle":"2022-07-28T18:33:42.385755Z","shell.execute_reply.started":"2022-07-28T18:33:42.378052Z","shell.execute_reply":"2022-07-28T18:33:42.384738Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Y.dtype","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:42.387491Z","iopub.execute_input":"2022-07-28T18:33:42.387945Z","iopub.status.idle":"2022-07-28T18:33:42.395446Z","shell.execute_reply.started":"2022-07-28T18:33:42.387911Z","shell.execute_reply":"2022-07-28T18:33:42.394416Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Y.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:42.396761Z","iopub.execute_input":"2022-07-28T18:33:42.397122Z","iopub.status.idle":"2022-07-28T18:33:42.405788Z","shell.execute_reply.started":"2022-07-28T18:33:42.397088Z","shell.execute_reply":"2022-07-28T18:33:42.404458Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#340085/118828","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:42.407266Z","iopub.execute_input":"2022-07-28T18:33:42.407801Z","iopub.status.idle":"2022-07-28T18:33:42.417028Z","shell.execute_reply.started":"2022-07-28T18:33:42.407765Z","shell.execute_reply":"2022-07-28T18:33:42.415743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"\nimport tensorflow as tf\ntf.random.set_seed(42)\n\n\nmodel = tf.keras.Sequential([\n    tf.keras.layers.Dense(128, activation='relu'),\n    tf.keras.layers.Dense(256, activation='relu'),\n    tf.keras.layers.Dense(256, activation='relu'),\n    tf.keras.layers.Dense(1, activation='sigmoid')\n])\n\nmodel.compile(\n    loss=tf.keras.losses.BinaryCrossentropy(),\n    optimizer=tf.keras.optimizers.Adam(),\n    metrics=['accuracy'\n    \n    ]\n)\n\nhistory = model.fit(X_train, y_train, epochs=10)","metadata":{"execution":{"iopub.status.busy":"2022-07-26T19:09:33.528210Z","iopub.execute_input":"2022-07-26T19:09:33.529081Z","iopub.status.idle":"2022-07-26T19:11:13.278548Z","shell.execute_reply.started":"2022-07-26T19:09:33.529040Z","shell.execute_reply":"2022-07-26T19:11:13.276616Z"}}},{"cell_type":"code","source":"###Lets try XGboost","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:33:42.418796Z","iopub.execute_input":"2022-07-28T18:33:42.419305Z","iopub.status.idle":"2022-07-28T18:33:42.426025Z","shell.execute_reply.started":"2022-07-28T18:33:42.419269Z","shell.execute_reply":"2022-07-28T18:33:42.425039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"params = {\n    'num_rounds':        1000,\n    'max_depth':         8,\n    'max_leaves':        2**8,\n    'alpha':             0.9,\n    'eta':               0.1,\n    'gamma':             0.1,\n    'learning_rate':     0.03,\n    'subsample':         1,\n    'reg_lambda':        1,\n    'scale_pos_weight':  2,\n    'tree_method':       'gpu_hist',\n    'n_gpus':            1,\n    'objective':         'binary:logistic',\n    'verbose':           True\n}","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:40.187441Z","iopub.execute_input":"2022-07-28T19:26:40.187859Z","iopub.status.idle":"2022-07-28T19:26:40.194433Z","shell.execute_reply.started":"2022-07-28T19:26:40.187812Z","shell.execute_reply":"2022-07-28T19:26:40.193337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time \n\ndtrain = xgb.DMatrix(X_train, label=y_train)\ndtest = xgb.DMatrix(X_test, label=y_test)\nevals = [(dtest, 'test',), (dtrain, 'train')]","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:41.522373Z","iopub.execute_input":"2022-07-28T19:26:41.522743Z","iopub.status.idle":"2022-07-28T19:26:44.550217Z","shell.execute_reply.started":"2022-07-28T19:26:41.522697Z","shell.execute_reply":"2022-07-28T19:26:44.549196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_rounds = params['num_rounds']","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:48.278661Z","iopub.execute_input":"2022-07-28T19:26:48.278995Z","iopub.status.idle":"2022-07-28T19:26:48.287291Z","shell.execute_reply.started":"2022-07-28T19:26:48.278965Z","shell.execute_reply":"2022-07-28T19:26:48.285920Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = xgb.train(params, dtrain, num_rounds, evals=evals)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:26:49.547447Z","iopub.execute_input":"2022-07-28T19:26:49.547757Z","iopub.status.idle":"2022-07-28T19:27:37.835708Z","shell.execute_reply.started":"2022-07-28T19:26:49.547729Z","shell.execute_reply":"2022-07-28T19:27:37.834614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"threshold = .5\n","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:03:12.442337Z","iopub.execute_input":"2022-07-23T15:03:12.442699Z","iopub.status.idle":"2022-07-23T15:03:12.448213Z","shell.execute_reply.started":"2022-07-23T15:03:12.442667Z","shell.execute_reply":"2022-07-23T15:03:12.447149Z"}}},{"cell_type":"code","source":"y_pred=model.predict(dtest)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:27:47.123531Z","iopub.execute_input":"2022-07-28T19:27:47.123928Z","iopub.status.idle":"2022-07-28T19:27:48.115085Z","shell.execute_reply.started":"2022-07-28T19:27:47.123890Z","shell.execute_reply":"2022-07-28T19:27:48.114143Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pred=y_pred.astype(int)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T18:44:17.924405Z","iopub.execute_input":"2022-07-28T18:44:17.925345Z","iopub.status.idle":"2022-07-28T18:44:17.931063Z","shell.execute_reply.started":"2022-07-28T18:44:17.925307Z","shell.execute_reply":"2022-07-28T18:44:17.929849Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"auc = roc_auc_score(y_test, y_pred)\nprint(auc)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:27:58.655958Z","iopub.execute_input":"2022-07-28T19:27:58.656294Z","iopub.status.idle":"2022-07-28T19:27:58.697932Z","shell.execute_reply.started":"2022-07-28T19:27:58.656265Z","shell.execute_reply":"2022-07-28T19:27:58.696865Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#print ('Accuracy:', accuracy_score(y_test, pred))","metadata":{"execution":{"iopub.status.busy":"2022-07-26T19:44:25.288041Z","iopub.execute_input":"2022-07-26T19:44:25.288413Z","iopub.status.idle":"2022-07-26T19:44:25.308441Z","shell.execute_reply.started":"2022-07-26T19:44:25.288379Z","shell.execute_reply":"2022-07-26T19:44:25.307357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"fpr, tpr, thresholds = roc_curve(y_test, pred)\nroc_auc = roc_auc_score(y_test, pred)\n\nplt.figure()\nplt.plot(fpr, tpr, color='darkorange', lw=1, label='ROC curve (area = %0.2f)' % roc_auc)\nplt.plot([0, 1], [0, 1], color='navy', linestyle='--')\nplt.xlim([0.0, 1.0])\nplt.ylim([0.0, 1.05])\nplt.xlabel('False Positive Rate')\nplt.ylabel('True Positive Rate')\nplt.title('Receiver operating characteristic')\nplt.legend(loc=\"lower right\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T12:27:43.839173Z","iopub.execute_input":"2022-07-26T12:27:43.839519Z","iopub.status.idle":"2022-07-26T12:27:44.115568Z","shell.execute_reply.started":"2022-07-26T12:27:43.839488Z","shell.execute_reply":"2022-07-26T12:27:44.114612Z"}}},{"cell_type":"code","source":"#pred.sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:37:25.012094Z","iopub.execute_input":"2022-07-23T14:37:25.012458Z","iopub.status.idle":"2022-07-23T14:37:25.023413Z","shell.execute_reply.started":"2022-07-23T14:37:25.012428Z","shell.execute_reply":"2022-07-23T14:37:25.02221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#cdf2.to_csv('categoral_train.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-16T10:16:15.354861Z","iopub.execute_input":"2022-07-16T10:16:15.35533Z","iopub.status.idle":"2022-07-16T10:16:15.48744Z","shell.execute_reply.started":"2022-07-16T10:16:15.355279Z","shell.execute_reply":"2022-07-16T10:16:15.48643Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2022-07-16T10:18:54.766525Z","iopub.execute_input":"2022-07-16T10:18:54.767025Z","iopub.status.idle":"2022-07-16T10:18:55.613867Z","shell.execute_reply.started":"2022-07-16T10:18:54.766974Z","shell.execute_reply":"2022-07-16T10:18:55.612832Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Let's generate the result using the gradient boost and see what happens\n","metadata":{}},{"cell_type":"code","source":"test=dask_cudf.read_csv('../input/amex-default-prediction/test_data.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:27:40.088142Z","iopub.execute_input":"2022-07-26T20:27:40.088482Z","iopub.status.idle":"2022-07-26T20:27:40.224107Z","shell.execute_reply.started":"2022-07-26T20:27:40.088451Z","shell.execute_reply":"2022-07-26T20:27:40.222237Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:27:41.586145Z","iopub.execute_input":"2022-07-26T20:27:41.586485Z","iopub.status.idle":"2022-07-26T20:27:41.608882Z","shell.execute_reply.started":"2022-07-26T20:27:41.586453Z","shell.execute_reply":"2022-07-26T20:27:41.607748Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ntdf1=test.drop_duplicates('customer_ID',keep='last').reset_index(drop=True)#.compute()\ntdf2=tdf1.drop(['S_2','D_63','D_64'],axis=1)\n#cdf3=cdf2.drop(, axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:28:38.191979Z","iopub.execute_input":"2022-07-26T20:28:38.192514Z","iopub.status.idle":"2022-07-26T20:28:38.270250Z","shell.execute_reply.started":"2022-07-26T20:28:38.192477Z","shell.execute_reply":"2022-07-26T20:28:38.269329Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_test=tdf2.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:29:07.411119Z","iopub.execute_input":"2022-07-26T20:29:07.411465Z","iopub.status.idle":"2022-07-26T20:31:34.399435Z","shell.execute_reply.started":"2022-07-26T20:29:07.411434Z","shell.execute_reply":"2022-07-26T20:31:34.397777Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test=x_test.iloc[:,1:]","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:31:55.254934Z","iopub.execute_input":"2022-07-26T20:31:55.255336Z","iopub.status.idle":"2022-07-26T20:31:55.320378Z","shell.execute_reply.started":"2022-07-26T20:31:55.255301Z","shell.execute_reply":"2022-07-26T20:31:55.319491Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_enc=cudf.read_csv('../input/one-hot-encoding-d-63-d-64/d_64_D_63_hot_test.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:33:56.990874Z","iopub.execute_input":"2022-07-28T19:33:56.991382Z","iopub.status.idle":"2022-07-28T19:33:57.309630Z","shell.execute_reply.started":"2022-07-28T19:33:56.991339Z","shell.execute_reply":"2022-07-28T19:33:57.308665Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testf=cudf.concat([test,test_enc],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-28T19:33:58.487714Z","iopub.execute_input":"2022-07-28T19:33:58.488262Z","iopub.status.idle":"2022-07-28T19:33:58.515507Z","shell.execute_reply.started":"2022-07-28T19:33:58.488229Z","shell.execute_reply":"2022-07-28T19:33:58.514376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_dataset=xgb.DMatrix(testf)","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:32:00.198490Z","iopub.execute_input":"2022-07-26T20:32:00.199093Z","iopub.status.idle":"2022-07-26T20:32:00.325092Z","shell.execute_reply.started":"2022-07-26T20:32:00.199053Z","shell.execute_reply":"2022-07-26T20:32:00.323912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=model.predict(test_dataset)","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:32:06.307088Z","iopub.execute_input":"2022-07-26T20:32:06.310012Z","iopub.status.idle":"2022-07-26T20:32:16.192190Z","shell.execute_reply.started":"2022-07-26T20:32:06.309974Z","shell.execute_reply":"2022-07-26T20:32:16.191169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"re=x_test.iloc[:,0:1]","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:32:16.193980Z","iopub.execute_input":"2022-07-26T20:32:16.194319Z","iopub.status.idle":"2022-07-26T20:32:16.201938Z","shell.execute_reply.started":"2022-07-26T20:32:16.194283Z","shell.execute_reply":"2022-07-26T20:32:16.200972Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"re['prediction']=predictions","metadata":{"execution":{"iopub.status.busy":"2022-07-26T20:32:16.203251Z","iopub.execute_input":"2022-07-26T20:32:16.204021Z","iopub.status.idle":"2022-07-26T20:32:16.220215Z","shell.execute_reply.started":"2022-07-26T20:32:16.203984Z","shell.execute_reply":"2022-07-26T20:32:16.219192Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#predict=predictions.astype(int)","metadata":{"execution":{"iopub.status.busy":"2022-07-26T19:01:23.061177Z","iopub.execute_input":"2022-07-26T19:01:23.061570Z","iopub.status.idle":"2022-07-26T19:01:23.072300Z","shell.execute_reply.started":"2022-07-26T19:01:23.061538Z","shell.execute_reply":"2022-07-26T19:01:23.071015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#result=pd.read_csv('../input/amex-default-prediction/sample_submission.csv')\n#result.drop('prediction',axis=1,inplace=True)\n#result['prediction']=predict","metadata":{"execution":{"iopub.status.busy":"2022-07-26T19:06:32.771593Z","iopub.execute_input":"2022-07-26T19:06:32.772424Z","iopub.status.idle":"2022-07-26T19:06:33.881291Z","shell.execute_reply.started":"2022-07-26T19:06:32.772359Z","shell.execute_reply":"2022-07-26T19:06:33.880221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"re.to_csv('submission.csv',index=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T16:05:10.96768Z","iopub.execute_input":"2022-07-23T16:05:10.968018Z","iopub.status.idle":"2022-07-23T16:05:11.130835Z","shell.execute_reply.started":"2022-07-23T16:05:10.967989Z","shell.execute_reply":"2022-07-23T16:05:11.1297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%%time\n#ddf1=cdf.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-16T09:37:55.71758Z","iopub.execute_input":"2022-07-16T09:37:55.721363Z","iopub.status.idle":"2022-07-16T09:39:11.989011Z","shell.execute_reply.started":"2022-07-16T09:37:55.721321Z","shell.execute_reply":"2022-07-16T09:39:11.987328Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#cdf2=cdf1.dropna()","metadata":{"execution":{"iopub.status.busy":"2022-07-16T10:44:02.767197Z","iopub.execute_input":"2022-07-16T10:44:02.767872Z","iopub.status.idle":"2022-07-16T10:44:02.781324Z","shell.execute_reply.started":"2022-07-16T10:44:02.767836Z","shell.execute_reply":"2022-07-16T10:44:02.779472Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#cdf1","metadata":{"execution":{"iopub.status.busy":"2022-07-16T11:11:11.498006Z","iopub.execute_input":"2022-07-16T11:11:11.498533Z","iopub.status.idle":"2022-07-16T11:11:11.645986Z","shell.execute_reply.started":"2022-07-16T11:11:11.498495Z","shell.execute_reply":"2022-07-16T11:11:11.644734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf2=ddf1.groupby('customer_ID')","metadata":{"execution":{"iopub.status.busy":"2022-07-16T09:40:06.492923Z","iopub.execute_input":"2022-07-16T09:40:06.493329Z","iopub.status.idle":"2022-07-16T09:40:06.501575Z","shell.execute_reply.started":"2022-07-16T09:40:06.493299Z","shell.execute_reply":"2022-07-16T09:40:06.499376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#print(ddf2['customer_ID'])","metadata":{"execution":{"iopub.status.busy":"2022-07-16T09:55:15.047526Z","iopub.execute_input":"2022-07-16T09:55:15.047917Z","iopub.status.idle":"2022-07-16T09:55:15.057658Z","shell.execute_reply.started":"2022-07-16T09:55:15.047872Z","shell.execute_reply":"2022-07-16T09:55:15.056149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%%time\n#ddf3=ddf2.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-16T09:42:12.007719Z","iopub.execute_input":"2022-07-16T09:42:12.008964Z","iopub.status.idle":"2022-07-16T09:42:12.055604Z","shell.execute_reply.started":"2022-07-16T09:42:12.008888Z","shell.execute_reply":"2022-07-16T09:42:12.054141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf2","metadata":{"execution":{"iopub.status.busy":"2022-07-16T09:40:10.443359Z","iopub.execute_input":"2022-07-16T09:40:10.443716Z","iopub.status.idle":"2022-07-16T09:40:10.457308Z","shell.execute_reply.started":"2022-07-16T09:40:10.443687Z","shell.execute_reply":"2022-07-16T09:40:10.455359Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf","metadata":{"execution":{"iopub.status.busy":"2022-07-12T07:23:41.498811Z","iopub.execute_input":"2022-07-12T07:23:41.499702Z","iopub.status.idle":"2022-07-12T07:23:41.528353Z","shell.execute_reply.started":"2022-07-12T07:23:41.499667Z","shell.execute_reply":"2022-07-12T07:23:41.527306Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf.drop(['S_2'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-12T05:59:32.287558Z","iopub.execute_input":"2022-07-12T05:59:32.287981Z","iopub.status.idle":"2022-07-12T05:59:32.324864Z","shell.execute_reply.started":"2022-07-12T05:59:32.287952Z","shell.execute_reply":"2022-07-12T05:59:32.323533Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%%time\n#ddf1=ddf.groupby('customer_ID').compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-12T06:25:17.436711Z","iopub.execute_input":"2022-07-12T06:25:17.437077Z","iopub.status.idle":"2022-07-12T06:25:17.475159Z","shell.execute_reply.started":"2022-07-12T06:25:17.437023Z","shell.execute_reply":"2022-07-12T06:25:17.473743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf1","metadata":{"execution":{"iopub.status.busy":"2022-07-12T06:23:26.770612Z","iopub.execute_input":"2022-07-12T06:23:26.771001Z","iopub.status.idle":"2022-07-12T06:23:26.781287Z","shell.execute_reply.started":"2022-07-12T06:23:26.77097Z","shell.execute_reply":"2022-07-12T06:23:26.779647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%%time\n#ddf2=ddf.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-12T06:25:37.8162Z","iopub.execute_input":"2022-07-12T06:25:37.816738Z","iopub.status.idle":"2022-07-12T06:25:43.399004Z","shell.execute_reply.started":"2022-07-12T06:25:37.816695Z","shell.execute_reply":"2022-07-12T06:25:43.397723Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf2.describe()","metadata":{"execution":{"iopub.status.busy":"2022-07-12T06:26:41.838251Z","iopub.execute_input":"2022-07-12T06:26:41.838711Z","iopub.status.idle":"2022-07-12T06:26:42.764472Z","shell.execute_reply.started":"2022-07-12T06:26:41.838681Z","shell.execute_reply":"2022-07-12T06:26:42.763103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#a=ddf['D_63'].compute().value_counts","metadata":{"execution":{"iopub.status.busy":"2022-07-10T12:42:52.050892Z","iopub.execute_input":"2022-07-10T12:42:52.051223Z","iopub.status.idle":"2022-07-10T12:44:01.502628Z","shell.execute_reply.started":"2022-07-10T12:42:52.051195Z","shell.execute_reply":"2022-07-10T12:44:01.501639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%%time\n#ddf['D_63'].compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-10T12:45:11.72386Z","iopub.execute_input":"2022-07-10T12:45:11.724446Z","iopub.status.idle":"2022-07-10T12:46:08.064245Z","shell.execute_reply.started":"2022-07-10T12:45:11.724411Z","shell.execute_reply":"2022-07-10T12:46:08.063069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf.summarise","metadata":{"execution":{"iopub.status.busy":"2022-07-10T12:50:25.363322Z","iopub.execute_input":"2022-07-10T12:50:25.363989Z","iopub.status.idle":"2022-07-10T12:50:25.394221Z","shell.execute_reply.started":"2022-07-10T12:50:25.363942Z","shell.execute_reply":"2022-07-10T12:50:25.392705Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#ddf.dtypes\n#!pwd","metadata":{"execution":{"iopub.status.busy":"2022-07-12T05:52:01.077717Z","iopub.execute_input":"2022-07-12T05:52:01.078128Z","iopub.status.idle":"2022-07-12T05:52:01.904816Z","shell.execute_reply.started":"2022-07-12T05:52:01.078095Z","shell.execute_reply":"2022-07-12T05:52:01.903266Z"},"trusted":true},"execution_count":null,"outputs":[]}]}