{"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-06-14T13:18:15.871694Z","iopub.execute_input":"2022-06-14T13:18:15.872116Z","iopub.status.idle":"2022-06-14T13:18:15.883110Z","shell.execute_reply.started":"2022-06-14T13:18:15.872083Z","shell.execute_reply":"2022-06-14T13:18:15.882367Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\nfrom sklearn import preprocessing\nfrom keras.models import Sequential\nfrom keras.layers import Dense\nfrom sklearn.model_selection import train_test_split","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:15.889642Z","iopub.execute_input":"2022-06-14T13:18:15.890282Z","iopub.status.idle":"2022-06-14T13:18:15.895404Z","shell.execute_reply.started":"2022-06-14T13:18:15.890247Z","shell.execute_reply":"2022-06-14T13:18:15.894386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.set_option(\"display.max_columns\",None)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:15.899708Z","iopub.execute_input":"2022-06-14T13:18:15.900196Z","iopub.status.idle":"2022-06-14T13:18:15.908684Z","shell.execute_reply.started":"2022-06-14T13:18:15.900166Z","shell.execute_reply":"2022-06-14T13:18:15.907686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We tak small sample size","metadata":{}},{"cell_type":"code","source":"train_data = pd.read_csv('/kaggle/input/amex-default-prediction/train_data.csv', nrows=200000)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:15.920347Z","iopub.execute_input":"2022-06-14T13:18:15.921006Z","iopub.status.idle":"2022-06-14T13:18:24.389417Z","shell.execute_reply.started":"2022-06-14T13:18:15.920968Z","shell.execute_reply":"2022-06-14T13:18:24.388395Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_labels = pd.read_csv(\"/kaggle/input/amex-default-prediction/train_labels.csv\", nrows=200000)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:24.392776Z","iopub.execute_input":"2022-06-14T13:18:24.393242Z","iopub.status.idle":"2022-06-14T13:18:24.632821Z","shell.execute_reply.started":"2022-06-14T13:18:24.393203Z","shell.execute_reply":"2022-06-14T13:18:24.631770Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission = pd.read_csv(\"/kaggle/input/amex-default-prediction/sample_submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:24.634280Z","iopub.execute_input":"2022-06-14T13:18:24.635235Z","iopub.status.idle":"2022-06-14T13:18:25.757406Z","shell.execute_reply.started":"2022-06-14T13:18:24.635187Z","shell.execute_reply":"2022-06-14T13:18:25.756396Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#select_cols = ['customer_ID',  'S_2', 'B_30', 'B_38', 'D_114', 'D_116', 'D_117', 'D_120', 'D_126', 'D_63', 'D_64', 'D_66', 'D_68']\nselect_cols = ['customer_ID',   '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-06-14T13:18:25.759767Z","iopub.execute_input":"2022-06-14T13:18:25.760363Z","iopub.status.idle":"2022-06-14T13:18:25.765117Z","shell.execute_reply.started":"2022-06-14T13:18:25.760315Z","shell.execute_reply":"2022-06-14T13:18:25.764489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#test_data = pd.read_csv(\"/kaggle/input/amex-default-prediction/test_data.csv\", usecols=select_cols)\n#test_data = pd.read_parquet(\"/kaggle/input/amex-parquet/test_data.parquet\", columns=select_cols)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.765985Z","iopub.execute_input":"2022-06-14T13:18:25.766630Z","iopub.status.idle":"2022-06-14T13:18:25.777910Z","shell.execute_reply.started":"2022-06-14T13:18:25.766596Z","shell.execute_reply":"2022-06-14T13:18:25.777195Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#test_data.head(2)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.778825Z","iopub.execute_input":"2022-06-14T13:18:25.779723Z","iopub.status.idle":"2022-06-14T13:18:25.789698Z","shell.execute_reply.started":"2022-06-14T13:18:25.779684Z","shell.execute_reply":"2022-06-14T13:18:25.788412Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#test_data.shape","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.791017Z","iopub.execute_input":"2022-06-14T13:18:25.791358Z","iopub.status.idle":"2022-06-14T13:18:25.801693Z","shell.execute_reply.started":"2022-06-14T13:18:25.791328Z","shell.execute_reply":"2022-06-14T13:18:25.800695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#sample_submission.shape","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.802969Z","iopub.execute_input":"2022-06-14T13:18:25.803349Z","iopub.status.idle":"2022-06-14T13:18:25.812184Z","shell.execute_reply.started":"2022-06-14T13:18:25.803316Z","shell.execute_reply":"2022-06-14T13:18:25.811400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Number of rows in train data {}\".format(train_data.shape[0]))\nprint(\"Number of cols in train data {}\".format(train_data.shape[1]))","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.813592Z","iopub.execute_input":"2022-06-14T13:18:25.814071Z","iopub.status.idle":"2022-06-14T13:18:25.827760Z","shell.execute_reply.started":"2022-06-14T13:18:25.814039Z","shell.execute_reply":"2022-06-14T13:18:25.826696Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Number of rows in labels data {}\".format(train_labels.shape[0]))\nprint(\"Number of cols in labels data {}\".format(train_labels.shape[1]))","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.830422Z","iopub.execute_input":"2022-06-14T13:18:25.831087Z","iopub.status.idle":"2022-06-14T13:18:25.840705Z","shell.execute_reply.started":"2022-06-14T13:18:25.831046Z","shell.execute_reply":"2022-06-14T13:18:25.840033Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_labels.head(2)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.841782Z","iopub.execute_input":"2022-06-14T13:18:25.842714Z","iopub.status.idle":"2022-06-14T13:18:25.858260Z","shell.execute_reply.started":"2022-06-14T13:18:25.842680Z","shell.execute_reply":"2022-06-14T13:18:25.857241Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"find a unique customer id","metadata":{}},{"cell_type":"code","source":"len(train_labels['customer_ID'].unique())","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.859581Z","iopub.execute_input":"2022-06-14T13:18:25.860487Z","iopub.status.idle":"2022-06-14T13:18:25.940758Z","shell.execute_reply.started":"2022-06-14T13:18:25.860449Z","shell.execute_reply":"2022-06-14T13:18:25.939728Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#sample_submission.head()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.942078Z","iopub.execute_input":"2022-06-14T13:18:25.942396Z","iopub.status.idle":"2022-06-14T13:18:25.946443Z","shell.execute_reply.started":"2022-06-14T13:18:25.942370Z","shell.execute_reply":"2022-06-14T13:18:25.945463Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Number of unique customer in train data","metadata":{}},{"cell_type":"code","source":"train_data['customer_ID'].nunique() ","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.947827Z","iopub.execute_input":"2022-06-14T13:18:25.948364Z","iopub.status.idle":"2022-06-14T13:18:25.994862Z","shell.execute_reply.started":"2022-06-14T13:18:25.948318Z","shell.execute_reply":"2022-06-14T13:18:25.994137Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.head()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:25.996286Z","iopub.execute_input":"2022-06-14T13:18:25.997349Z","iopub.status.idle":"2022-06-14T13:18:26.144573Z","shell.execute_reply.started":"2022-06-14T13:18:25.997303Z","shell.execute_reply":"2022-06-14T13:18:26.143605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.info()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:26.145801Z","iopub.execute_input":"2022-06-14T13:18:26.146143Z","iopub.status.idle":"2022-06-14T13:18:26.166154Z","shell.execute_reply.started":"2022-06-14T13:18:26.146102Z","shell.execute_reply":"2022-06-14T13:18:26.164944Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.describe()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:26.167583Z","iopub.execute_input":"2022-06-14T13:18:26.168244Z","iopub.status.idle":"2022-06-14T13:18:28.461844Z","shell.execute_reply.started":"2022-06-14T13:18:26.168203Z","shell.execute_reply":"2022-06-14T13:18:28.460704Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = train_data[select_cols]","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.463041Z","iopub.execute_input":"2022-06-14T13:18:28.463411Z","iopub.status.idle":"2022-06-14T13:18:28.476606Z","shell.execute_reply.started":"2022-06-14T13:18:28.463379Z","shell.execute_reply":"2022-06-14T13:18:28.475750Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Number of rows in train data {}\".format(train_data.shape[0]))\nprint(\"Number of cols in train data {}\".format(train_data.shape[1]))","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.477884Z","iopub.execute_input":"2022-06-14T13:18:28.478922Z","iopub.status.idle":"2022-06-14T13:18:28.489009Z","shell.execute_reply.started":"2022-06-14T13:18:28.478876Z","shell.execute_reply":"2022-06-14T13:18:28.488330Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.490341Z","iopub.execute_input":"2022-06-14T13:18:28.490881Z","iopub.status.idle":"2022-06-14T13:18:28.506511Z","shell.execute_reply.started":"2022-06-14T13:18:28.490849Z","shell.execute_reply":"2022-06-14T13:18:28.505804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = train_data.groupby(['customer_ID']).mean()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.507847Z","iopub.execute_input":"2022-06-14T13:18:28.508213Z","iopub.status.idle":"2022-06-14T13:18:28.580428Z","shell.execute_reply.started":"2022-06-14T13:18:28.508181Z","shell.execute_reply":"2022-06-14T13:18:28.579422Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.shape","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.581682Z","iopub.execute_input":"2022-06-14T13:18:28.582032Z","iopub.status.idle":"2022-06-14T13:18:28.587937Z","shell.execute_reply.started":"2022-06-14T13:18:28.582001Z","shell.execute_reply":"2022-06-14T13:18:28.587061Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.head(2)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.589466Z","iopub.execute_input":"2022-06-14T13:18:28.589790Z","iopub.status.idle":"2022-06-14T13:18:28.611568Z","shell.execute_reply.started":"2022-06-14T13:18:28.589762Z","shell.execute_reply":"2022-06-14T13:18:28.610856Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data.reset_index()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.612690Z","iopub.execute_input":"2022-06-14T13:18:28.613420Z","iopub.status.idle":"2022-06-14T13:18:28.637186Z","shell.execute_reply.started":"2022-06-14T13:18:28.613389Z","shell.execute_reply":"2022-06-14T13:18:28.636204Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"feature_label = train_data.merge(train_labels, left_on='customer_ID', right_on='customer_ID')","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.638412Z","iopub.execute_input":"2022-06-14T13:18:28.638762Z","iopub.status.idle":"2022-06-14T13:18:28.752789Z","shell.execute_reply.started":"2022-06-14T13:18:28.638732Z","shell.execute_reply":"2022-06-14T13:18:28.751775Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"feature_label.head()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.754402Z","iopub.execute_input":"2022-06-14T13:18:28.755002Z","iopub.status.idle":"2022-06-14T13:18:28.773230Z","shell.execute_reply.started":"2022-06-14T13:18:28.754961Z","shell.execute_reply":"2022-06-14T13:18:28.772293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"feature_label.shape","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.774421Z","iopub.execute_input":"2022-06-14T13:18:28.774774Z","iopub.status.idle":"2022-06-14T13:18:28.780820Z","shell.execute_reply.started":"2022-06-14T13:18:28.774744Z","shell.execute_reply":"2022-06-14T13:18:28.779897Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tmp = feature_label['target'].value_counts().div(len(feature_label)).mul(100)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.786363Z","iopub.execute_input":"2022-06-14T13:18:28.787463Z","iopub.status.idle":"2022-06-14T13:18:28.793902Z","shell.execute_reply.started":"2022-06-14T13:18:28.787422Z","shell.execute_reply":"2022-06-14T13:18:28.793002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ax = sns.barplot(x= tmp.index, y= tmp.values)\nax.bar_label(ax.containers[0], fmt=\"%.f%%\")\nplt.title(\"Distribution of a target variable\")\nplt.ylabel(\"Percentage [%]\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.795373Z","iopub.execute_input":"2022-06-14T13:18:28.796256Z","iopub.status.idle":"2022-06-14T13:18:28.931307Z","shell.execute_reply.started":"2022-06-14T13:18:28.796209Z","shell.execute_reply":"2022-06-14T13:18:28.930166Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"feature_cols = ['B_30', 'B_38', 'D_114', 'D_116', 'D_117', 'D_120', 'D_126',  'D_66', 'D_68']\ntarget_cols = ['target']","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.933184Z","iopub.execute_input":"2022-06-14T13:18:28.933931Z","iopub.status.idle":"2022-06-14T13:18:28.939276Z","shell.execute_reply.started":"2022-06-14T13:18:28.933881Z","shell.execute_reply":"2022-06-14T13:18:28.938448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train, x_test, y_train, y_test = train_test_split(feature_label[feature_cols],feature_label[target_cols] , test_size = 0.2, random_state=90)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.941172Z","iopub.execute_input":"2022-06-14T13:18:28.942167Z","iopub.status.idle":"2022-06-14T13:18:28.959391Z","shell.execute_reply.started":"2022-06-14T13:18:28.942100Z","shell.execute_reply":"2022-06-14T13:18:28.958413Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = Sequential()\nmodel.add(Dense(24, input_dim=9, activation='relu'))\nmodel.add(Dense(12, activation='relu'))\nmodel.add(Dense(8, activation='relu'))\nmodel.add(Dense(4, activation='relu'))\n\nmodel.add(Dense(1, activation='sigmoid'))","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:28.961190Z","iopub.execute_input":"2022-06-14T13:18:28.961903Z","iopub.status.idle":"2022-06-14T13:18:29.013446Z","shell.execute_reply.started":"2022-06-14T13:18:28.961849Z","shell.execute_reply":"2022-06-14T13:18:29.012762Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(model.summary())","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:29.014825Z","iopub.execute_input":"2022-06-14T13:18:29.015804Z","iopub.status.idle":"2022-06-14T13:18:29.022662Z","shell.execute_reply.started":"2022-06-14T13:18:29.015758Z","shell.execute_reply":"2022-06-14T13:18:29.021566Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from tensorflow.keras.optimizers import SGD ","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:29.024258Z","iopub.execute_input":"2022-06-14T13:18:29.024892Z","iopub.status.idle":"2022-06-14T13:18:29.035656Z","shell.execute_reply.started":"2022-06-14T13:18:29.024847Z","shell.execute_reply":"2022-06-14T13:18:29.034513Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:29.037431Z","iopub.execute_input":"2022-06-14T13:18:29.037898Z","iopub.status.idle":"2022-06-14T13:18:29.053089Z","shell.execute_reply.started":"2022-06-14T13:18:29.037849Z","shell.execute_reply":"2022-06-14T13:18:29.052307Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history  = model.fit(x_train, y_train, epochs=10, batch_size=20)","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:29.054445Z","iopub.execute_input":"2022-06-14T13:18:29.055324Z","iopub.status.idle":"2022-06-14T13:18:41.044737Z","shell.execute_reply.started":"2022-06-14T13:18:29.055275Z","shell.execute_reply":"2022-06-14T13:18:41.043611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# evaluate the keras model\n_, accuracy = model.evaluate(x_train,y_train)\nprint('Accuracy: %.2f'%(accuracy*100))","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:41.046467Z","iopub.execute_input":"2022-06-14T13:18:41.047080Z","iopub.status.idle":"2022-06-14T13:18:41.846080Z","shell.execute_reply.started":"2022-06-14T13:18:41.047039Z","shell.execute_reply":"2022-06-14T13:18:41.844362Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#saved performance result\nhistory_dict = history.history\n\nloss_values = history_dict['loss']\n#val_loss_values = history_dict['val_loss']\n\nepochs = range(1, len(loss_values)+1)\n\n\n#line1 = plt.plot(epochs, val_loss_values, label='Validation/Test Loss')\nline2 = plt.plot(epochs, loss_values, label = 'Training Loss')\n#plt.setp(line1, linewidth=2.0, marker='+', markersize=10.0)\nplt.setp(line2, linewidth=2.0, marker='4', markersize=10.0)\nplt.xlabel('Epochs')\nplt.ylabel('Loss')\nplt.grid(True)\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:41.847545Z","iopub.execute_input":"2022-06-14T13:18:41.848272Z","iopub.status.idle":"2022-06-14T13:18:41.998033Z","shell.execute_reply.started":"2022-06-14T13:18:41.848225Z","shell.execute_reply":"2022-06-14T13:18:41.997071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_prediction = model.predict(x_test)\n# round predictions\ntest_rounded = [round(x[0]) for x in test_prediction]","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:41.999559Z","iopub.execute_input":"2022-06-14T13:18:42.000029Z","iopub.status.idle":"2022-06-14T13:18:42.238174Z","shell.execute_reply.started":"2022-06-14T13:18:41.999985Z","shell.execute_reply":"2022-06-14T13:18:42.237190Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import confusion_matrix\n\nprint(confusion_matrix(y_test, test_rounded))","metadata":{"execution":{"iopub.status.busy":"2022-06-14T13:18:42.239324Z","iopub.execute_input":"2022-06-14T13:18:42.241546Z","iopub.status.idle":"2022-06-14T13:18:42.250362Z","shell.execute_reply.started":"2022-06-14T13:18:42.241506Z","shell.execute_reply":"2022-06-14T13:18:42.249313Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}