{"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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-23T14:12:44.793675Z","iopub.execute_input":"2022-07-23T14:12:44.794532Z","iopub.status.idle":"2022-07-23T14:12:48.747686Z","shell.execute_reply.started":"2022-07-23T14:12:44.794423Z","shell.execute_reply":"2022-07-23T14:12:48.746689Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from dask.distributed import Client\nclient = Client(n_workers=4, threads_per_worker=4, memory_limit='15GB')\nclient","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:12:48.749528Z","iopub.execute_input":"2022-07-23T14:12:48.749899Z","iopub.status.idle":"2022-07-23T14:12:52.473374Z","shell.execute_reply.started":"2022-07-23T14:12:48.749869Z","shell.execute_reply":"2022-07-23T14:12:52.472193Z"},"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-23T14:13:05.074162Z","iopub.execute_input":"2022-07-23T14:13:05.074570Z","iopub.status.idle":"2022-07-23T14:13:05.080310Z","shell.execute_reply.started":"2022-07-23T14:13:05.074533Z","shell.execute_reply":"2022-07-23T14:13:05.079287Z"},"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-23T11:32:31.515770Z","iopub.execute_input":"2022-07-23T11:32:31.516137Z","iopub.status.idle":"2022-07-23T11:32:31.520784Z","shell.execute_reply.started":"2022-07-23T11:32:31.516107Z","shell.execute_reply":"2022-07-23T11:32:31.519790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n\ncdf=dask_cudf.read_csv('../input/amex-default-prediction/train_data.csv',usecols=selected_columns,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-23T14:13:07.265167Z","iopub.execute_input":"2022-07-23T14:13:07.265621Z","iopub.status.idle":"2022-07-23T14:13:09.578281Z","shell.execute_reply.started":"2022-07-23T14:13:07.265574Z","shell.execute_reply":"2022-07-23T14:13:09.577186Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ncdf1=cdf.drop_duplicates('customer_ID')#.compute()\ncdf2=cdf1.drop('S_2',axis=1)\ncdf3=cdf2.drop('customer_ID', axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:13:10.736983Z","iopub.execute_input":"2022-07-23T14:13:10.737316Z","iopub.status.idle":"2022-07-23T14:13:10.758464Z","shell.execute_reply.started":"2022-07-23T14:13:10.737281Z","shell.execute_reply":"2022-07-23T14:13:10.757558Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nX=cdf3.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:13:14.309607Z","iopub.execute_input":"2022-07-23T14:13:14.310486Z","iopub.status.idle":"2022-07-23T14:14:21.751179Z","shell.execute_reply.started":"2022-07-23T14:13:14.310451Z","shell.execute_reply":"2022-07-23T14:14:21.750220Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2022-07-23T16:13:07.174482Z","iopub.execute_input":"2022-07-23T16:13:07.175288Z","iopub.status.idle":"2022-07-23T16:13:07.201795Z","shell.execute_reply.started":"2022-07-23T16:13:07.175249Z","shell.execute_reply":"2022-07-23T16:13:07.200794Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X.to_csv('train_cat.csv',index=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:16:24.245434Z","iopub.execute_input":"2022-07-23T14:16:24.246107Z","iopub.status.idle":"2022-07-23T14:16:24.279466Z","shell.execute_reply.started":"2022-07-23T14:16:24.246071Z","shell.execute_reply":"2022-07-23T14:16:24.278561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X=pd.read_csv('train_cat.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:16:27.490082Z","iopub.execute_input":"2022-07-23T14:16:27.490444Z","iopub.status.idle":"2022-07-23T14:16:27.725127Z","shell.execute_reply.started":"2022-07-23T14:16:27.490414Z","shell.execute_reply":"2022-07-23T14:16:27.723814Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X","metadata":{"execution":{"iopub.status.busy":"2022-07-23T06:41:36.179783Z","iopub.execute_input":"2022-07-23T06:41:36.180113Z","iopub.status.idle":"2022-07-23T06:41:36.213902Z","shell.execute_reply.started":"2022-07-23T06:41:36.180085Z","shell.execute_reply":"2022-07-23T06:41:36.212883Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"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-23T14:16:31.189890Z","iopub.execute_input":"2022-07-23T14:16:31.190262Z","iopub.status.idle":"2022-07-23T14:16:31.996315Z","shell.execute_reply.started":"2022-07-23T14:16:31.190234Z","shell.execute_reply":"2022-07-23T14:16:31.995349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nY=y['target']","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:16:32.960436Z","iopub.execute_input":"2022-07-23T14:16:32.960807Z","iopub.status.idle":"2022-07-23T14:16:32.976460Z","shell.execute_reply.started":"2022-07-23T14:16:32.960779Z","shell.execute_reply":"2022-07-23T14:16:32.975317Z"},"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(X,Y, test_size=0.2, stratify=Y)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:16:35.753357Z","iopub.execute_input":"2022-07-23T14:16:35.753799Z","iopub.status.idle":"2022-07-23T14:16:36.221965Z","shell.execute_reply.started":"2022-07-23T14:16:35.753762Z","shell.execute_reply":"2022-07-23T14:16:36.220756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#X_train.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-23T11:35:05.846817Z","iopub.execute_input":"2022-07-23T11:35:05.847697Z","iopub.status.idle":"2022-07-23T11:35:05.855932Z","shell.execute_reply.started":"2022-07-23T11:35:05.847650Z","shell.execute_reply":"2022-07-23T11:35:05.854964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#y_train.shape\n","metadata":{"execution":{"iopub.status.busy":"2022-07-23T11:35:12.639671Z","iopub.execute_input":"2022-07-23T11:35:12.640131Z","iopub.status.idle":"2022-07-23T11:35:12.653104Z","shell.execute_reply.started":"2022-07-23T11:35:12.640091Z","shell.execute_reply":"2022-07-23T11:35:12.651601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Y.dtype","metadata":{"execution":{"iopub.status.busy":"2022-07-23T11:36:36.879523Z","iopub.execute_input":"2022-07-23T11:36:36.880105Z","iopub.status.idle":"2022-07-23T11:36:36.887307Z","shell.execute_reply.started":"2022-07-23T11:36:36.880071Z","shell.execute_reply":"2022-07-23T11:36:36.886168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Y.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-23T11:53:20.174910Z","iopub.execute_input":"2022-07-23T11:53:20.175267Z","iopub.status.idle":"2022-07-23T11:53:20.187970Z","shell.execute_reply.started":"2022-07-23T11:53:20.175239Z","shell.execute_reply":"2022-07-23T11:53:20.186823Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#340085/118828","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:54:56.532306Z","iopub.execute_input":"2022-07-23T14:54:56.532845Z","iopub.status.idle":"2022-07-23T14:54:56.538870Z","shell.execute_reply.started":"2022-07-23T14:54:56.532809Z","shell.execute_reply":"2022-07-23T14:54:56.537762Z"},"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-23T12:07:38.656741Z","iopub.execute_input":"2022-07-23T12:07:38.657096Z","iopub.status.idle":"2022-07-23T12:08:24.088388Z","shell.execute_reply.started":"2022-07-23T12:07:38.657066Z","shell.execute_reply":"2022-07-23T12:08:24.086990Z"}}},{"cell_type":"code","source":"###Lets try XGboost","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:16:53.752769Z","iopub.execute_input":"2022-07-23T14:16:53.753168Z","iopub.status.idle":"2022-07-23T14:16:53.757517Z","shell.execute_reply.started":"2022-07-23T14:16:53.753136Z","shell.execute_reply":"2022-07-23T14:16:53.756462Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import 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","metadata":{"execution":{"iopub.status.busy":"2022-07-23T14:21:00.680252Z","iopub.execute_input":"2022-07-23T14:21:00.680632Z","iopub.status.idle":"2022-07-23T14:21:00.780240Z","shell.execute_reply.started":"2022-07-23T14:21:00.680589Z","shell.execute_reply":"2022-07-23T14:21:00.779303Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"params = {\n    'num_rounds':        100,\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.3,\n    'subsample':         1,\n    'reg_lambda':        1,\n    'scale_pos_weight':  2.86,\n    'tree_method':       'gpu_hist',\n    'n_gpus':            1,\n    'objective':         'binary:hinge',\n    'verbose':           True\n}","metadata":{"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-23T15:05:29.950235Z","iopub.execute_input":"2022-07-23T15:05:29.950611Z","iopub.status.idle":"2022-07-23T15:05:30.053871Z","shell.execute_reply.started":"2022-07-23T15:05:29.950579Z","shell.execute_reply":"2022-07-23T15:05:30.053075Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_rounds = params['num_rounds']","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:05:31.085262Z","iopub.execute_input":"2022-07-23T15:05:31.085651Z","iopub.status.idle":"2022-07-23T15:05:31.093655Z","shell.execute_reply.started":"2022-07-23T15:05:31.085612Z","shell.execute_reply":"2022-07-23T15:05:31.091872Z"},"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-23T15:05:32.188460Z","iopub.execute_input":"2022-07-23T15:05:32.189168Z","iopub.status.idle":"2022-07-23T15:05:33.449460Z","shell.execute_reply.started":"2022-07-23T15:05:32.189119Z","shell.execute_reply":"2022-07-23T15:05:33.448418Z"},"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-23T15:05:44.051105Z","iopub.execute_input":"2022-07-23T15:05:44.051521Z","iopub.status.idle":"2022-07-23T15:05:44.062650Z","shell.execute_reply.started":"2022-07-23T15:05:44.051473Z","shell.execute_reply":"2022-07-23T15:05:44.061392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#y_pred","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:05:53.754815Z","iopub.execute_input":"2022-07-23T15:05:53.755723Z","iopub.status.idle":"2022-07-23T15:05:53.768716Z","shell.execute_reply.started":"2022-07-23T15:05:53.755678Z","shell.execute_reply":"2022-07-23T15:05:53.767219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pred=y_pred.astype(int)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:06:13.835485Z","iopub.execute_input":"2022-07-23T15:06:13.836147Z","iopub.status.idle":"2022-07-23T15:06:13.840589Z","shell.execute_reply.started":"2022-07-23T15:06:13.836112Z","shell.execute_reply":"2022-07-23T15:06:13.839641Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#auc = roc_auc_score(y_test, pred)\n#print(auc)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:06:17.659238Z","iopub.execute_input":"2022-07-23T15:06:17.659629Z","iopub.status.idle":"2022-07-23T15:06:17.688168Z","shell.execute_reply.started":"2022-07-23T15:06:17.659596Z","shell.execute_reply":"2022-07-23T15:06:17.686935Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#print ('Accuracy:', accuracy_score(y_test, pred))","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:06:21.339964Z","iopub.execute_input":"2022-07-23T15:06:21.340338Z","iopub.status.idle":"2022-07-23T15:06:21.358593Z","shell.execute_reply.started":"2022-07-23T15:06:21.340309Z","shell.execute_reply":"2022-07-23T15:06:21.357559Z"},"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-23T14:59:12.114969Z","iopub.execute_input":"2022-07-23T14:59:12.115349Z","iopub.status.idle":"2022-07-23T14:59:12.342449Z","shell.execute_reply.started":"2022-07-23T14:59:12.115318Z","shell.execute_reply":"2022-07-23T14:59:12.341404Z"}}},{"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.022210Z"},"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.355330Z","iopub.status.idle":"2022-07-16T10:16:15.487440Z","shell.execute_reply.started":"2022-07-16T10:16:15.355279Z","shell.execute_reply":"2022-07-16T10:16:15.486430Z"},"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":"%%time\n\ntdf=dask_cudf.read_csv('../input/amex-default-prediction/test_data.csv',usecols=selected_columns,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-23T15:15:36.412799Z","iopub.execute_input":"2022-07-23T15:15:36.413155Z","iopub.status.idle":"2022-07-23T15:15:36.491255Z","shell.execute_reply.started":"2022-07-23T15:15:36.413124Z","shell.execute_reply":"2022-07-23T15:15:36.489974Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ntdf1=tdf.drop_duplicates('customer_ID')#.compute()\ntdf2=tdf1.drop('S_2',axis=1)\n#tdf3=df2.drop('customer_ID', axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:22:03.251093Z","iopub.execute_input":"2022-07-23T15:22:03.251442Z","iopub.status.idle":"2022-07-23T15:22:03.278467Z","shell.execute_reply.started":"2022-07-23T15:22:03.251413Z","shell.execute_reply":"2022-07-23T15:22:03.277042Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_test=tdf2.compute()","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:25:30.313586Z","iopub.execute_input":"2022-07-23T15:25:30.314167Z","iopub.status.idle":"2022-07-23T15:27:20.051756Z","shell.execute_reply.started":"2022-07-23T15:25:30.314132Z","shell.execute_reply":"2022-07-23T15:27:20.050610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_test=x_test.reset_index(drop=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:36:29.553492Z","iopub.execute_input":"2022-07-23T15:36:29.554218Z","iopub.status.idle":"2022-07-23T15:36:29.564952Z","shell.execute_reply.started":"2022-07-23T15:36:29.554181Z","shell.execute_reply":"2022-07-23T15:36:29.563922Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data=x_test.iloc[:,1:]","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:36:32.724709Z","iopub.execute_input":"2022-07-23T15:36:32.725618Z","iopub.status.idle":"2022-07-23T15:36:32.735335Z","shell.execute_reply.started":"2022-07-23T15:36:32.725570Z","shell.execute_reply":"2022-07-23T15:36:32.734325Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:36:37.042325Z","iopub.execute_input":"2022-07-23T15:36:37.042744Z","iopub.status.idle":"2022-07-23T15:36:37.158569Z","shell.execute_reply.started":"2022-07-23T15:36:37.042714Z","shell.execute_reply":"2022-07-23T15:36:37.157397Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_dataset=xgb.DMatrix(test_data)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:43:25.271567Z","iopub.execute_input":"2022-07-23T15:43:25.272552Z","iopub.status.idle":"2022-07-23T15:43:25.294638Z","shell.execute_reply.started":"2022-07-23T15:43:25.272495Z","shell.execute_reply":"2022-07-23T15:43:25.293718Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=model.predict(test_dataset)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:43:30.956426Z","iopub.execute_input":"2022-07-23T15:43:30.957343Z","iopub.status.idle":"2022-07-23T15:43:30.992812Z","shell.execute_reply.started":"2022-07-23T15:43:30.957291Z","shell.execute_reply":"2022-07-23T15:43:30.991685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict=predictions.astype(int)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:44:11.992215Z","iopub.execute_input":"2022-07-23T15:44:11.992695Z","iopub.status.idle":"2022-07-23T15:44:11.998807Z","shell.execute_reply.started":"2022-07-23T15:44:11.992655Z","shell.execute_reply":"2022-07-23T15:44:11.997586Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.DataFrame(predict,columns=['prediction'])","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:45:36.102631Z","iopub.execute_input":"2022-07-23T15:45:36.103325Z","iopub.status.idle":"2022-07-23T15:45:36.111495Z","shell.execute_reply.started":"2022-07-23T15:45:36.103275Z","shell.execute_reply":"2022-07-23T15:45:36.110559Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a=x_test['customer_ID']","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:47:26.430950Z","iopub.execute_input":"2022-07-23T15:47:26.431273Z","iopub.status.idle":"2022-07-23T15:47:26.435594Z","shell.execute_reply.started":"2022-07-23T15:47:26.431244Z","shell.execute_reply":"2022-07-23T15:47:26.434680Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a=a.to_frame()","metadata":{"execution":{"iopub.status.busy":"2022-07-23T15:56:53.109476Z","iopub.execute_input":"2022-07-23T15:56:53.110091Z","iopub.status.idle":"2022-07-23T15:56:53.115611Z","shell.execute_reply.started":"2022-07-23T15:56:53.110056Z","shell.execute_reply":"2022-07-23T15:56:53.114416Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a['prediction']=predict","metadata":{"execution":{"iopub.status.busy":"2022-07-23T16:04:18.195696Z","iopub.execute_input":"2022-07-23T16:04:18.196293Z","iopub.status.idle":"2022-07-23T16:04:18.209751Z","shell.execute_reply.started":"2022-07-23T16:04:18.196262Z","shell.execute_reply":"2022-07-23T16:04:18.208528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a.to_csv('submission.csv',index=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-23T16:05:10.967680Z","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.129700Z"},"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.717580Z","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.770970Z","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.816200Z","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":[]}]}