{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "ZBI0cTFEUr0L" }, "source": [ "# Credit Card Fraud Detection" ] }, { "cell_type": "markdown", "metadata": { "id": "RHSOUyC0Ur0S" }, "source": [ "## Importing Dependencies" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "SeS8YiePjzTs" }, "outputs": [], "source": [ "# Importing the libraries\n", "import numpy as np\n", "import pandas as pd\n", "import time\n", "\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline\n", "import seaborn as sns\n", "\n", "from scipy import stats\n", "from scipy.stats import norm, skew\n", "from scipy.special import boxcox1p\n", "from scipy.stats import boxcox_normmax\n", "\n", "from sklearn import preprocessing\n", "from sklearn.preprocessing import StandardScaler\n", "\n", "import sklearn\n", "from sklearn import metrics\n", "from sklearn.metrics import roc_curve, auc, roc_auc_score \n", "from sklearn.metrics import classification_report,confusion_matrix\n", "from sklearn.metrics import average_precision_score, precision_recall_curve\n", "\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.model_selection import StratifiedKFold\n", "from sklearn.model_selection import GridSearchCV, RandomizedSearchCV\n", "\n", "from sklearn.linear_model import Ridge, Lasso, LogisticRegression\n", "from sklearn.neighbors import KNeighborsClassifier\n", "from sklearn.linear_model import LogisticRegressionCV\n", "from sklearn.tree import DecisionTreeClassifier\n", "from sklearn.ensemble import AdaBoostClassifier\n", "from sklearn.ensemble import RandomForestClassifier\n", "import xgboost as xgb\n", "from xgboost import XGBClassifier\n", "from xgboost import plot_importance\n", "from sklearn.ensemble import AdaBoostClassifier\n", "\n", "# To ignore warnings\n", "import warnings\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "markdown", "metadata": { "id": "mHgkzM2NkFQ1" }, "source": [ "## Exploratory data analysis" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "IKsQai74jBJb", "outputId": "45e29237-931c-4e8f-a0bb-1ddb817a552f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mounted at /content/gdrive\n" ] } ], "source": [ "# Mounting the google drive\n", "from google.colab import drive\n", "drive.mount('/content/gdrive')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 236 }, "id": "eX-7qfaVkMCT", "outputId": "c96fd856-f02a-49f1-af79-cc2e131c0307" }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " | Time | \n", "V1 | \n", "V2 | \n", "V3 | \n", "V4 | \n", "V5 | \n", "V6 | \n", "V7 | \n", "V8 | \n", "V9 | \n", "... | \n", "V21 | \n", "V22 | \n", "V23 | \n", "V24 | \n", "V25 | \n", "V26 | \n", "V27 | \n", "V28 | \n", "Amount | \n", "Class | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0.0 | \n", "-1.359807 | \n", "-0.072781 | \n", "2.536347 | \n", "1.378155 | \n", "-0.338321 | \n", "0.462388 | \n", "0.239599 | \n", "0.098698 | \n", "0.363787 | \n", "... | \n", "-0.018307 | \n", "0.277838 | \n", "-0.110474 | \n", "0.066928 | \n", "0.128539 | \n", "-0.189115 | \n", "0.133558 | \n", "-0.021053 | \n", "149.62 | \n", "0 | \n", "
1 | \n", "0.0 | \n", "1.191857 | \n", "0.266151 | \n", "0.166480 | \n", "0.448154 | \n", "0.060018 | \n", "-0.082361 | \n", "-0.078803 | \n", "0.085102 | \n", "-0.255425 | \n", "... | \n", "-0.225775 | \n", "-0.638672 | \n", "0.101288 | \n", "-0.339846 | \n", "0.167170 | \n", "0.125895 | \n", "-0.008983 | \n", "0.014724 | \n", "2.69 | \n", "0 | \n", "
2 | \n", "1.0 | \n", "-1.358354 | \n", "-1.340163 | \n", "1.773209 | \n", "0.379780 | \n", "-0.503198 | \n", "1.800499 | \n", "0.791461 | \n", "0.247676 | \n", "-1.514654 | \n", "... | \n", "0.247998 | \n", "0.771679 | \n", "0.909412 | \n", "-0.689281 | \n", "-0.327642 | \n", "-0.139097 | \n", "-0.055353 | \n", "-0.059752 | \n", "378.66 | \n", "0 | \n", "
3 | \n", "1.0 | \n", "-0.966272 | \n", "-0.185226 | \n", "1.792993 | \n", "-0.863291 | \n", "-0.010309 | \n", "1.247203 | \n", "0.237609 | \n", "0.377436 | \n", "-1.387024 | \n", "... | \n", "-0.108300 | \n", "0.005274 | \n", "-0.190321 | \n", "-1.175575 | \n", "0.647376 | \n", "-0.221929 | \n", "0.062723 | \n", "0.061458 | \n", "123.50 | \n", "0 | \n", "
4 | \n", "2.0 | \n", "-1.158233 | \n", "0.877737 | \n", "1.548718 | \n", "0.403034 | \n", "-0.407193 | \n", "0.095921 | \n", "0.592941 | \n", "-0.270533 | \n", "0.817739 | \n", "... | \n", "-0.009431 | \n", "0.798278 | \n", "-0.137458 | \n", "0.141267 | \n", "-0.206010 | \n", "0.502292 | \n", "0.219422 | \n", "0.215153 | \n", "69.99 | \n", "0 | \n", "
5 rows × 31 columns
\n", "\n", " | Time | \n", "V1 | \n", "V2 | \n", "V3 | \n", "V4 | \n", "V5 | \n", "V6 | \n", "V7 | \n", "V8 | \n", "V9 | \n", "... | \n", "V21 | \n", "V22 | \n", "V23 | \n", "V24 | \n", "V25 | \n", "V26 | \n", "V27 | \n", "V28 | \n", "Amount | \n", "Class | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | \n", "284807.000000 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "... | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "2.848070e+05 | \n", "284807.000000 | \n", "284807.000000 | \n", "
mean | \n", "94813.859575 | \n", "1.168375e-15 | \n", "3.416908e-16 | \n", "-1.379537e-15 | \n", "2.074095e-15 | \n", "9.604066e-16 | \n", "1.487313e-15 | \n", "-5.556467e-16 | \n", "1.213481e-16 | \n", "-2.406331e-15 | \n", "... | \n", "1.654067e-16 | \n", "-3.568593e-16 | \n", "2.578648e-16 | \n", "4.473266e-15 | \n", "5.340915e-16 | \n", "1.683437e-15 | \n", "-3.660091e-16 | \n", "-1.227390e-16 | \n", "88.349619 | \n", "0.001727 | \n", "
std | \n", "47488.145955 | \n", "1.958696e+00 | \n", "1.651309e+00 | \n", "1.516255e+00 | \n", "1.415869e+00 | \n", "1.380247e+00 | \n", "1.332271e+00 | \n", "1.237094e+00 | \n", "1.194353e+00 | \n", "1.098632e+00 | \n", "... | \n", "7.345240e-01 | \n", "7.257016e-01 | \n", "6.244603e-01 | \n", "6.056471e-01 | \n", "5.212781e-01 | \n", "4.822270e-01 | \n", "4.036325e-01 | \n", "3.300833e-01 | \n", "250.120109 | \n", "0.041527 | \n", "
min | \n", "0.000000 | \n", "-5.640751e+01 | \n", "-7.271573e+01 | \n", "-4.832559e+01 | \n", "-5.683171e+00 | \n", "-1.137433e+02 | \n", "-2.616051e+01 | \n", "-4.355724e+01 | \n", "-7.321672e+01 | \n", "-1.343407e+01 | \n", "... | \n", "-3.483038e+01 | \n", "-1.093314e+01 | \n", "-4.480774e+01 | \n", "-2.836627e+00 | \n", "-1.029540e+01 | \n", "-2.604551e+00 | \n", "-2.256568e+01 | \n", "-1.543008e+01 | \n", "0.000000 | \n", "0.000000 | \n", "
25% | \n", "54201.500000 | \n", "-9.203734e-01 | \n", "-5.985499e-01 | \n", "-8.903648e-01 | \n", "-8.486401e-01 | \n", "-6.915971e-01 | \n", "-7.682956e-01 | \n", "-5.540759e-01 | \n", "-2.086297e-01 | \n", "-6.430976e-01 | \n", "... | \n", "-2.283949e-01 | \n", "-5.423504e-01 | \n", "-1.618463e-01 | \n", "-3.545861e-01 | \n", "-3.171451e-01 | \n", "-3.269839e-01 | \n", "-7.083953e-02 | \n", "-5.295979e-02 | \n", "5.600000 | \n", "0.000000 | \n", "
50% | \n", "84692.000000 | \n", "1.810880e-02 | \n", "6.548556e-02 | \n", "1.798463e-01 | \n", "-1.984653e-02 | \n", "-5.433583e-02 | \n", "-2.741871e-01 | \n", "4.010308e-02 | \n", "2.235804e-02 | \n", "-5.142873e-02 | \n", "... | \n", "-2.945017e-02 | \n", "6.781943e-03 | \n", "-1.119293e-02 | \n", "4.097606e-02 | \n", "1.659350e-02 | \n", "-5.213911e-02 | \n", "1.342146e-03 | \n", "1.124383e-02 | \n", "22.000000 | \n", "0.000000 | \n", "
75% | \n", "139320.500000 | \n", "1.315642e+00 | \n", "8.037239e-01 | \n", "1.027196e+00 | \n", "7.433413e-01 | \n", "6.119264e-01 | \n", "3.985649e-01 | \n", "5.704361e-01 | \n", "3.273459e-01 | \n", "5.971390e-01 | \n", "... | \n", "1.863772e-01 | \n", "5.285536e-01 | \n", "1.476421e-01 | \n", "4.395266e-01 | \n", "3.507156e-01 | \n", "2.409522e-01 | \n", "9.104512e-02 | \n", "7.827995e-02 | \n", "77.165000 | \n", "0.000000 | \n", "
max | \n", "172792.000000 | \n", "2.454930e+00 | \n", "2.205773e+01 | \n", "9.382558e+00 | \n", "1.687534e+01 | \n", "3.480167e+01 | \n", "7.330163e+01 | \n", "1.205895e+02 | \n", "2.000721e+01 | \n", "1.559499e+01 | \n", "... | \n", "2.720284e+01 | \n", "1.050309e+01 | \n", "2.252841e+01 | \n", "4.584549e+00 | \n", "7.519589e+00 | \n", "3.517346e+00 | \n", "3.161220e+01 | \n", "3.384781e+01 | \n", "25691.160000 | \n", "1.000000 | \n", "
8 rows × 31 columns
\n", "\n", " | Time | \n", "V1 | \n", "V2 | \n", "V3 | \n", "V4 | \n", "V5 | \n", "V6 | \n", "V7 | \n", "V8 | \n", "V9 | \n", "... | \n", "V21 | \n", "V22 | \n", "V23 | \n", "V24 | \n", "V25 | \n", "V26 | \n", "V27 | \n", "V28 | \n", "Amount | \n", "Class | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time | \n", "1.000000 | \n", "1.173963e-01 | \n", "-1.059333e-02 | \n", "-4.196182e-01 | \n", "-1.052602e-01 | \n", "1.730721e-01 | \n", "-6.301647e-02 | \n", "8.471437e-02 | \n", "-3.694943e-02 | \n", "-8.660434e-03 | \n", "... | \n", "4.473573e-02 | \n", "1.440591e-01 | \n", "5.114236e-02 | \n", "-1.618187e-02 | \n", "-2.330828e-01 | \n", "-4.140710e-02 | \n", "-5.134591e-03 | \n", "-9.412688e-03 | \n", "-0.010596 | \n", "-0.012323 | \n", "
V1 | \n", "0.117396 | \n", "1.000000e+00 | \n", "4.135835e-16 | \n", "-1.227819e-15 | \n", "-9.215150e-16 | \n", "1.812612e-17 | \n", "-6.506567e-16 | \n", "-1.005191e-15 | \n", "-2.433822e-16 | \n", "-1.513678e-16 | \n", "... | \n", "-2.457409e-16 | \n", "-4.290944e-16 | \n", "6.168652e-16 | \n", "-4.425156e-17 | \n", "-9.605737e-16 | \n", "-1.581290e-17 | \n", "1.198124e-16 | \n", "2.083082e-15 | \n", "-0.227709 | \n", "-0.101347 | \n", "
V2 | \n", "-0.010593 | \n", "4.135835e-16 | \n", "1.000000e+00 | \n", "3.243764e-16 | \n", "-1.121065e-15 | \n", "5.157519e-16 | \n", "2.787346e-16 | \n", "2.055934e-16 | \n", "-5.377041e-17 | \n", "1.978488e-17 | \n", "... | \n", "-8.480447e-17 | \n", "1.526333e-16 | \n", "1.634231e-16 | \n", "1.247925e-17 | \n", "-4.478846e-16 | \n", "2.057310e-16 | \n", "-4.966953e-16 | \n", "-5.093836e-16 | \n", "-0.531409 | \n", "0.091289 | \n", "
V3 | \n", "-0.419618 | \n", "-1.227819e-15 | \n", "3.243764e-16 | \n", "1.000000e+00 | \n", "4.711293e-16 | \n", "-6.539009e-17 | \n", "1.627627e-15 | \n", "4.895305e-16 | \n", "-1.268779e-15 | \n", "5.568367e-16 | \n", "... | \n", "5.706192e-17 | \n", "-1.133902e-15 | \n", "-4.983035e-16 | \n", "2.686834e-19 | \n", "-1.104734e-15 | \n", "-1.238062e-16 | \n", "1.045747e-15 | \n", "9.775546e-16 | \n", "-0.210880 | \n", "-0.192961 | \n", "
V4 | \n", "-0.105260 | \n", "-9.215150e-16 | \n", "-1.121065e-15 | \n", "4.711293e-16 | \n", "1.000000e+00 | \n", "-1.719944e-15 | \n", "-7.491959e-16 | \n", "-4.104503e-16 | \n", "5.697192e-16 | \n", "6.923247e-16 | \n", "... | \n", "-1.949553e-16 | \n", "-6.276051e-17 | \n", "9.164206e-17 | \n", "1.584638e-16 | \n", "6.070716e-16 | \n", "-4.247268e-16 | \n", "3.977061e-17 | \n", "-2.761403e-18 | \n", "0.098732 | \n", "0.133447 | \n", "
V5 | \n", "0.173072 | \n", "1.812612e-17 | \n", "5.157519e-16 | \n", "-6.539009e-17 | \n", "-1.719944e-15 | \n", "1.000000e+00 | \n", "2.408382e-16 | \n", "2.715541e-16 | \n", "7.437229e-16 | \n", "7.391702e-16 | \n", "... | \n", "-3.920976e-16 | \n", "1.253751e-16 | \n", "-8.428683e-18 | \n", "-1.149255e-15 | \n", "4.808532e-16 | \n", "4.319541e-16 | \n", "6.590482e-16 | \n", "-5.613951e-18 | \n", "-0.386356 | \n", "-0.094974 | \n", "
V6 | \n", "-0.063016 | \n", "-6.506567e-16 | \n", "2.787346e-16 | \n", "1.627627e-15 | \n", "-7.491959e-16 | \n", "2.408382e-16 | \n", "1.000000e+00 | \n", "1.191668e-16 | \n", "-1.104219e-16 | \n", "4.131207e-16 | \n", "... | \n", "5.833316e-17 | \n", "-4.705235e-19 | \n", "1.046712e-16 | \n", "-1.071589e-15 | \n", "4.562861e-16 | \n", "-1.357067e-16 | \n", "-4.452461e-16 | \n", "2.594754e-16 | \n", "0.215981 | \n", "-0.043643 | \n", "
V7 | \n", "0.084714 | \n", "-1.005191e-15 | \n", "2.055934e-16 | \n", "4.895305e-16 | \n", "-4.104503e-16 | \n", "2.715541e-16 | \n", "1.191668e-16 | \n", "1.000000e+00 | \n", "3.344412e-16 | \n", "1.122501e-15 | \n", "... | \n", "-2.027779e-16 | \n", "-8.898922e-16 | \n", "-4.387401e-16 | \n", "7.434913e-18 | \n", "-3.094082e-16 | \n", "-9.657637e-16 | \n", "-1.782106e-15 | \n", "-2.776530e-16 | \n", "0.397311 | \n", "-0.187257 | \n", "
V8 | \n", "-0.036949 | \n", "-2.433822e-16 | \n", "-5.377041e-17 | \n", "-1.268779e-15 | \n", "5.697192e-16 | \n", "7.437229e-16 | \n", "-1.104219e-16 | \n", "3.344412e-16 | \n", "1.000000e+00 | \n", "4.356078e-16 | \n", "... | \n", "3.892798e-16 | \n", "2.026927e-16 | \n", "6.377260e-17 | \n", "-1.047097e-16 | \n", "-4.653279e-16 | \n", "-1.727276e-16 | \n", "1.299943e-16 | \n", "-6.200930e-16 | \n", "-0.103079 | \n", "0.019875 | \n", "
V9 | \n", "-0.008660 | \n", "-1.513678e-16 | \n", "1.978488e-17 | \n", "5.568367e-16 | \n", "6.923247e-16 | \n", "7.391702e-16 | \n", "4.131207e-16 | \n", "1.122501e-15 | \n", "4.356078e-16 | \n", "1.000000e+00 | \n", "... | \n", "1.936953e-16 | \n", "-7.071869e-16 | \n", "-5.214137e-16 | \n", "-1.430343e-16 | \n", "6.757763e-16 | \n", "-7.888853e-16 | \n", "-6.709655e-17 | \n", "1.110541e-15 | \n", "-0.044246 | \n", "-0.097733 | \n", "
V10 | \n", "0.030617 | \n", "7.388135e-17 | \n", "-3.991394e-16 | \n", "1.156587e-15 | \n", "2.232685e-16 | \n", "-5.202306e-16 | \n", "5.932243e-17 | \n", "-7.492834e-17 | \n", "-2.801370e-16 | \n", "-4.642274e-16 | \n", "... | \n", "1.177547e-15 | \n", "-6.418202e-16 | \n", "3.214491e-16 | \n", "-1.355885e-16 | \n", "-2.846052e-16 | \n", "-3.028119e-16 | \n", "-2.197977e-16 | \n", "4.864782e-17 | \n", "-0.101502 | \n", "-0.216883 | \n", "
V11 | \n", "-0.247689 | \n", "2.125498e-16 | \n", "1.975426e-16 | \n", "1.576830e-15 | \n", "3.459380e-16 | \n", "7.203963e-16 | \n", "1.980503e-15 | \n", "1.425248e-16 | \n", "2.487043e-16 | \n", "1.354680e-16 | \n", "... | \n", "-5.658364e-16 | \n", "7.772895e-16 | \n", "-4.505332e-16 | \n", "1.933267e-15 | \n", "-5.600475e-16 | \n", "-1.003221e-16 | \n", "-2.640281e-16 | \n", "-3.792314e-16 | \n", "0.000104 | \n", "0.154876 | \n", "
V12 | \n", "0.124348 | \n", "2.053457e-16 | \n", "-9.568710e-17 | \n", "6.310231e-16 | \n", "-5.625518e-16 | \n", "7.412552e-16 | \n", "2.375468e-16 | \n", "-3.536655e-18 | \n", "1.839891e-16 | \n", "-1.079314e-15 | \n", "... | \n", "7.300527e-16 | \n", "1.644699e-16 | \n", "1.800885e-16 | \n", "4.436512e-16 | \n", "-5.712973e-16 | \n", "-2.359969e-16 | \n", "-4.672391e-16 | \n", "6.415167e-16 | \n", "-0.009542 | \n", "-0.260593 | \n", "
V13 | \n", "-0.065902 | \n", "-2.425603e-17 | \n", "6.295388e-16 | \n", "2.807652e-16 | \n", "1.303306e-16 | \n", "5.886991e-16 | \n", "-1.211182e-16 | \n", "1.266462e-17 | \n", "-2.921856e-16 | \n", "2.251072e-15 | \n", "... | \n", "1.008461e-16 | \n", "6.747721e-17 | \n", "-7.132064e-16 | \n", "-1.397470e-16 | \n", "-5.497612e-16 | \n", "-1.769255e-16 | \n", "-4.720898e-16 | \n", "1.144372e-15 | \n", "0.005293 | \n", "-0.004570 | \n", "
V14 | \n", "-0.098757 | \n", "-5.020280e-16 | \n", "-1.730566e-16 | \n", "4.739859e-16 | \n", "2.282280e-16 | \n", "6.565143e-16 | \n", "2.621312e-16 | \n", "2.607772e-16 | \n", "-8.599156e-16 | \n", "3.784757e-15 | \n", "... | \n", "-3.356561e-16 | \n", "3.740383e-16 | \n", "3.883204e-16 | \n", "2.003482e-16 | \n", "-8.547932e-16 | \n", "-1.660327e-16 | \n", "1.044274e-16 | \n", "2.289427e-15 | \n", "0.033751 | \n", "-0.302544 | \n", "
V15 | \n", "-0.183453 | \n", "3.547782e-16 | \n", "-4.995814e-17 | \n", "9.068793e-16 | \n", "1.377649e-16 | \n", "-8.720275e-16 | \n", "-1.531188e-15 | \n", "-1.690540e-16 | \n", "4.127777e-16 | \n", "-1.051167e-15 | \n", "... | \n", "6.605263e-17 | \n", "-4.208921e-16 | \n", "-3.912243e-16 | \n", "-4.478263e-16 | \n", "3.206423e-16 | \n", "2.817791e-16 | \n", "-1.143519e-15 | \n", "-1.194130e-15 | \n", "-0.002986 | \n", "-0.004223 | \n", "
V16 | \n", "0.011903 | \n", "7.212815e-17 | \n", "1.177316e-17 | \n", "8.299445e-16 | \n", "-9.614528e-16 | \n", "2.246261e-15 | \n", "2.623672e-18 | \n", "5.869302e-17 | \n", "-5.254741e-16 | \n", "-1.214086e-15 | \n", "... | \n", "-4.715090e-16 | \n", "-7.923387e-17 | \n", "5.020770e-16 | \n", "-3.005985e-16 | \n", "-1.345418e-15 | \n", "-7.290010e-16 | \n", "6.789513e-16 | \n", "7.588849e-16 | \n", "-0.003910 | \n", "-0.196539 | \n", "
V17 | \n", "-0.073297 | \n", "-3.879840e-16 | \n", "-2.685296e-16 | \n", "7.614712e-16 | \n", "-2.699612e-16 | \n", "1.281914e-16 | \n", "2.015618e-16 | \n", "2.177192e-16 | \n", "-2.269549e-16 | \n", "1.113695e-15 | \n", "... | \n", "-8.230527e-16 | \n", "-8.743398e-16 | \n", "3.706214e-16 | \n", "-2.403828e-16 | \n", "2.666806e-16 | \n", "6.932833e-16 | \n", "6.148525e-16 | \n", "-5.534540e-17 | \n", "0.007309 | \n", "-0.326481 | \n", "
V18 | \n", "0.090438 | \n", "3.230206e-17 | \n", "3.284605e-16 | \n", "1.509897e-16 | \n", "-5.103644e-16 | \n", "5.308590e-16 | \n", "1.223814e-16 | \n", "7.604126e-17 | \n", "-3.667974e-16 | \n", "4.993240e-16 | \n", "... | \n", "-9.408680e-16 | \n", "-4.819365e-16 | \n", "-1.912006e-16 | \n", "-8.986916e-17 | \n", "-6.629212e-17 | \n", "2.990167e-16 | \n", "2.242791e-16 | \n", "7.976796e-16 | \n", "0.035650 | \n", "-0.111485 | \n", "
V19 | \n", "0.028975 | \n", "1.502024e-16 | \n", "-7.118719e-18 | \n", "3.463522e-16 | \n", "-3.980557e-16 | \n", "-1.450421e-16 | \n", "-1.865597e-16 | \n", "-1.881008e-16 | \n", "-3.875186e-16 | \n", "-1.376135e-16 | \n", "... | \n", "5.115885e-16 | \n", "-1.163768e-15 | \n", "7.032035e-16 | \n", "2.587708e-17 | \n", "9.577163e-16 | \n", "5.898033e-16 | \n", "-2.959370e-16 | \n", "-1.405379e-15 | \n", "-0.056151 | \n", "0.034783 | \n", "
V20 | \n", "-0.050866 | \n", "4.654551e-16 | \n", "2.506675e-16 | \n", "-9.316409e-16 | \n", "-1.857247e-16 | \n", "-3.554057e-16 | \n", "-1.858755e-16 | \n", "9.379684e-16 | \n", "2.033737e-16 | \n", "-2.343720e-16 | \n", "... | \n", "-7.614597e-16 | \n", "1.009285e-15 | \n", "2.712885e-16 | \n", "1.277215e-16 | \n", "1.410054e-16 | \n", "-2.803504e-16 | \n", "-1.138829e-15 | \n", "-2.436795e-16 | \n", "0.339403 | \n", "0.020090 | \n", "
V21 | \n", "0.044736 | \n", "-2.457409e-16 | \n", "-8.480447e-17 | \n", "5.706192e-17 | \n", "-1.949553e-16 | \n", "-3.920976e-16 | \n", "5.833316e-17 | \n", "-2.027779e-16 | \n", "3.892798e-16 | \n", "1.936953e-16 | \n", "... | \n", "1.000000e+00 | \n", "3.649908e-15 | \n", "8.119580e-16 | \n", "1.761054e-16 | \n", "-1.686082e-16 | \n", "-5.557329e-16 | \n", "-1.211281e-15 | \n", "5.278775e-16 | \n", "0.105999 | \n", "0.040413 | \n", "
V22 | \n", "0.144059 | \n", "-4.290944e-16 | \n", "1.526333e-16 | \n", "-1.133902e-15 | \n", "-6.276051e-17 | \n", "1.253751e-16 | \n", "-4.705235e-19 | \n", "-8.898922e-16 | \n", "2.026927e-16 | \n", "-7.071869e-16 | \n", "... | \n", "3.649908e-15 | \n", "1.000000e+00 | \n", "-7.303916e-17 | \n", "9.970809e-17 | \n", "-5.018575e-16 | \n", "-2.503187e-17 | \n", "8.461337e-17 | \n", "-6.627203e-16 | \n", "-0.064801 | \n", "0.000805 | \n", "
V23 | \n", "0.051142 | \n", "6.168652e-16 | \n", "1.634231e-16 | \n", "-4.983035e-16 | \n", "9.164206e-17 | \n", "-8.428683e-18 | \n", "1.046712e-16 | \n", "-4.387401e-16 | \n", "6.377260e-17 | \n", "-5.214137e-16 | \n", "... | \n", "8.119580e-16 | \n", "-7.303916e-17 | \n", "1.000000e+00 | \n", "2.130519e-17 | \n", "-8.232727e-17 | \n", "1.114524e-15 | \n", "2.839721e-16 | \n", "1.481903e-15 | \n", "-0.112633 | \n", "-0.002685 | \n", "
V24 | \n", "-0.016182 | \n", "-4.425156e-17 | \n", "1.247925e-17 | \n", "2.686834e-19 | \n", "1.584638e-16 | \n", "-1.149255e-15 | \n", "-1.071589e-15 | \n", "7.434913e-18 | \n", "-1.047097e-16 | \n", "-1.430343e-16 | \n", "... | \n", "1.761054e-16 | \n", "9.970809e-17 | \n", "2.130519e-17 | \n", "1.000000e+00 | \n", "1.015391e-15 | \n", "1.343722e-16 | \n", "-2.274142e-16 | \n", "-2.819805e-16 | \n", "0.005146 | \n", "-0.007221 | \n", "
V25 | \n", "-0.233083 | \n", "-9.605737e-16 | \n", "-4.478846e-16 | \n", "-1.104734e-15 | \n", "6.070716e-16 | \n", "4.808532e-16 | \n", "4.562861e-16 | \n", "-3.094082e-16 | \n", "-4.653279e-16 | \n", "6.757763e-16 | \n", "... | \n", "-1.686082e-16 | \n", "-5.018575e-16 | \n", "-8.232727e-17 | \n", "1.015391e-15 | \n", "1.000000e+00 | \n", "2.646517e-15 | \n", "-6.406679e-16 | \n", "-7.008939e-16 | \n", "-0.047837 | \n", "0.003308 | \n", "
V26 | \n", "-0.041407 | \n", "-1.581290e-17 | \n", "2.057310e-16 | \n", "-1.238062e-16 | \n", "-4.247268e-16 | \n", "4.319541e-16 | \n", "-1.357067e-16 | \n", "-9.657637e-16 | \n", "-1.727276e-16 | \n", "-7.888853e-16 | \n", "... | \n", "-5.557329e-16 | \n", "-2.503187e-17 | \n", "1.114524e-15 | \n", "1.343722e-16 | \n", "2.646517e-15 | \n", "1.000000e+00 | \n", "-3.667715e-16 | \n", "-2.782204e-16 | \n", "-0.003208 | \n", "0.004455 | \n", "
V27 | \n", "-0.005135 | \n", "1.198124e-16 | \n", "-4.966953e-16 | \n", "1.045747e-15 | \n", "3.977061e-17 | \n", "6.590482e-16 | \n", "-4.452461e-16 | \n", "-1.782106e-15 | \n", "1.299943e-16 | \n", "-6.709655e-17 | \n", "... | \n", "-1.211281e-15 | \n", "8.461337e-17 | \n", "2.839721e-16 | \n", "-2.274142e-16 | \n", "-6.406679e-16 | \n", "-3.667715e-16 | \n", "1.000000e+00 | \n", "-3.061287e-16 | \n", "0.028825 | \n", "0.017580 | \n", "
V28 | \n", "-0.009413 | \n", "2.083082e-15 | \n", "-5.093836e-16 | \n", "9.775546e-16 | \n", "-2.761403e-18 | \n", "-5.613951e-18 | \n", "2.594754e-16 | \n", "-2.776530e-16 | \n", "-6.200930e-16 | \n", "1.110541e-15 | \n", "... | \n", "5.278775e-16 | \n", "-6.627203e-16 | \n", "1.481903e-15 | \n", "-2.819805e-16 | \n", "-7.008939e-16 | \n", "-2.782204e-16 | \n", "-3.061287e-16 | \n", "1.000000e+00 | \n", "0.010258 | \n", "0.009536 | \n", "
Amount | \n", "-0.010596 | \n", "-2.277087e-01 | \n", "-5.314089e-01 | \n", "-2.108805e-01 | \n", "9.873167e-02 | \n", "-3.863563e-01 | \n", "2.159812e-01 | \n", "3.973113e-01 | \n", "-1.030791e-01 | \n", "-4.424560e-02 | \n", "... | \n", "1.059989e-01 | \n", "-6.480065e-02 | \n", "-1.126326e-01 | \n", "5.146217e-03 | \n", "-4.783686e-02 | \n", "-3.208037e-03 | \n", "2.882546e-02 | \n", "1.025822e-02 | \n", "1.000000 | \n", "0.005632 | \n", "
Class | \n", "-0.012323 | \n", "-1.013473e-01 | \n", "9.128865e-02 | \n", "-1.929608e-01 | \n", "1.334475e-01 | \n", "-9.497430e-02 | \n", "-4.364316e-02 | \n", "-1.872566e-01 | \n", "1.987512e-02 | \n", "-9.773269e-02 | \n", "... | \n", "4.041338e-02 | \n", "8.053175e-04 | \n", "-2.685156e-03 | \n", "-7.220907e-03 | \n", "3.307706e-03 | \n", "4.455398e-03 | \n", "1.757973e-02 | \n", "9.536041e-03 | \n", "0.005632 | \n", "1.000000 | \n", "
31 rows × 31 columns
\n", "\n", " | V1 | \n", "V2 | \n", "V3 | \n", "V4 | \n", "V5 | \n", "V6 | \n", "V7 | \n", "V8 | \n", "V9 | \n", "V10 | \n", "... | \n", "V21 | \n", "V22 | \n", "V23 | \n", "V24 | \n", "V25 | \n", "V26 | \n", "V27 | \n", "V28 | \n", "Amount | \n", "Time_Hour | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-1.359807 | \n", "-0.072781 | \n", "2.536347 | \n", "1.378155 | \n", "-0.338321 | \n", "0.462388 | \n", "0.239599 | \n", "0.098698 | \n", "0.363787 | \n", "0.090794 | \n", "... | \n", "-0.018307 | \n", "0.277838 | \n", "-0.110474 | \n", "0.066928 | \n", "0.128539 | \n", "-0.189115 | \n", "0.133558 | \n", "-0.021053 | \n", "149.62 | \n", "0 | \n", "
1 | \n", "1.191857 | \n", "0.266151 | \n", "0.166480 | \n", "0.448154 | \n", "0.060018 | \n", "-0.082361 | \n", "-0.078803 | \n", "0.085102 | \n", "-0.255425 | \n", "-0.166974 | \n", "... | \n", "-0.225775 | \n", "-0.638672 | \n", "0.101288 | \n", "-0.339846 | \n", "0.167170 | \n", "0.125895 | \n", "-0.008983 | \n", "0.014724 | \n", "2.69 | \n", "0 | \n", "
2 | \n", "-1.358354 | \n", "-1.340163 | \n", "1.773209 | \n", "0.379780 | \n", "-0.503198 | \n", "1.800499 | \n", "0.791461 | \n", "0.247676 | \n", "-1.514654 | \n", "0.207643 | \n", "... | \n", "0.247998 | \n", "0.771679 | \n", "0.909412 | \n", "-0.689281 | \n", "-0.327642 | \n", "-0.139097 | \n", "-0.055353 | \n", "-0.059752 | \n", "378.66 | \n", "0 | \n", "
3 | \n", "-0.966272 | \n", "-0.185226 | \n", "1.792993 | \n", "-0.863291 | \n", "-0.010309 | \n", "1.247203 | \n", "0.237609 | \n", "0.377436 | \n", "-1.387024 | \n", "-0.054952 | \n", "... | \n", "-0.108300 | \n", "0.005274 | \n", "-0.190321 | \n", "-1.175575 | \n", "0.647376 | \n", "-0.221929 | \n", "0.062723 | \n", "0.061458 | \n", "123.50 | \n", "0 | \n", "
4 | \n", "-1.158233 | \n", "0.877737 | \n", "1.548718 | \n", "0.403034 | \n", "-0.407193 | \n", "0.095921 | \n", "0.592941 | \n", "-0.270533 | \n", "0.817739 | \n", "0.753074 | \n", "... | \n", "-0.009431 | \n", "0.798278 | \n", "-0.137458 | \n", "0.141267 | \n", "-0.206010 | \n", "0.502292 | \n", "0.219422 | \n", "0.215153 | \n", "69.99 | \n", "0 | \n", "
5 rows × 30 columns
\n", "\n", " | Methodology | \n", "Model | \n", "Accuracy | \n", "roc_value | \n", "threshold | \n", "
---|---|---|---|---|---|
0 | \n", "RepeatedKFold Cross Validation | \n", "Logistic Regression with L2 Regularisation | \n", "0.998876 | \n", "0.988054 | \n", "0.001599 | \n", "
1 | \n", "RepeatedKFold Cross Validation | \n", "Logistic Regression with L1 Regularisation | \n", "0.998894 | \n", "0.875459 | \n", "0.056357 | \n", "
2 | \n", "RepeatedKFold Cross Validation | \n", "KNN | \n", "0.999105 | \n", "0.855570 | \n", "0.200000 | \n", "
3 | \n", "RepeatedKFold Cross Validation | \n", "Tree Model with gini criteria | \n", "0.998982 | \n", "0.855523 | \n", "1.000000 | \n", "
4 | \n", "RepeatedKFold Cross Validation | \n", "Tree Model with entropy criteria | \n", "0.999140 | \n", "0.874798 | \n", "1.000000 | \n", "
5 | \n", "RepeatedKFold Cross Validation | \n", "Random Forest | \n", "0.999403 | \n", "0.935799 | \n", "0.020000 | \n", "
6 | \n", "RepeatedKFold Cross Validation | \n", "XGBoost | \n", "0.999298 | \n", "0.984330 | \n", "0.001838 | \n", "
7 | \n", "RepeatedKFold Cross Validation | \n", "SVM | \n", "0.998139 | \n", "0.496765 | \n", "0.002992 | \n", "