{
  "metadata": {
    "kernelspec": {
      "name": "python",
      "display_name": "Python (Pyodide)",
      "language": "python"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "python",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.8"
    }
  },
  "nbformat_minor": 5,
  "nbformat": 4,
  "cells": [
    {
      "id": "4572253f-47a0-4c98-8852-cd8a0fa5c461",
      "cell_type": "code",
      "source": "import numpy as np\n\n# Требуемые модули из sklearn\nfrom sklearn.datasets import make_classification\nfrom sklearn.metrics import confusion_matrix, classification_report, accuracy_score, roc_auc_score\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.neighbors import KNeighborsClassifier\n\n#Графики\nimport matplotlib.pyplot as plt",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 1
    },
    {
      "id": "d731e066-0f22-4bab-a620-7e437ea55d11",
      "cell_type": "code",
      "source": "def plot_2d_separator(classifier, X, fill=False, line=True, ax=None, eps=None):\n    if eps is None:\n        eps = 1.0 #X.std() / 2.\n    x_min, x_max = X[:, 0].min() - eps, X[:, 0].max() + eps\n    y_min, y_max = X[:, 1].min() - eps, X[:, 1].max() + eps\n    xx = np.linspace(x_min, x_max, 100)\n    yy = np.linspace(y_min, y_max, 100)\n    X1, X2 = np.meshgrid(xx, yy)\n    X_grid = np.c_[X1.ravel(), X2.ravel()]\n    try:\n        decision_values = classifier.decision_function(X_grid)\n        levels = [0]\n        fill_levels = [decision_values.min(), 0, decision_values.max()]\n    except AttributeError:\n        # no decision_function\n        decision_values = classifier.predict_proba(X_grid)[:, 1]\n        levels = [.5]\n        fill_levels = [0, .5, 1]\n        if ax is None:\n            ax = plt.gca()\n        if fill:\n            ax.contourf(X1, X2, decision_values.reshape(X1.shape),\n            levels=fill_levels, colors=['cyan', 'pink', 'yellow'])\n        if line:\n            ax.contour(X1, X2, decision_values.reshape(X1.shape), levels=levels, colors=\"black\")\n        ax.set_xlim(x_min, x_max)\n        ax.set_ylim(y_min, y_max)\n        ax.set_xticks(())\n        ax.set_yticks(())",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 2
    },
    {
      "id": "ea8112ad-501f-4afd-baa7-9a69395c5a38",
      "cell_type": "code",
      "source": "X, y = make_classification(n_features=2, random_state = 78, class_sep = 0.45, n_redundant=0, n_informative=1, n_clusters_per_class=1,  n_samples = 1000)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 3
    },
    {
      "id": "6ef2a9f4-4bcf-4123-8688-7dc5ea3a23ee",
      "cell_type": "code",
      "source": "print (\"Координаты точек: \") \nprint (X[:15])\nprint (\"Метки класса: \") \nprint (y[:15])",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Координаты точек: \n[[ 1.48828264e+00 -7.10442604e-01]\n [-7.10253928e-01  6.93938341e-01]\n [ 5.33444250e-01 -1.31136377e+00]\n [ 1.08104452e+00  5.34466225e-01]\n [-3.97224728e-01  1.29783335e-01]\n [ 1.12862644e-01  5.10913913e-01]\n [ 7.13520454e-04  7.42926105e-01]\n [-1.50699375e+00 -1.51932200e+00]\n [-7.09257115e-01  4.58339246e-01]\n [-1.51395805e+00 -1.13202013e-01]\n [ 1.64173194e+00  5.62099713e-01]\n [-2.07311044e+00 -7.20098263e-01]\n [ 1.21634891e+00  4.34451064e-01]\n [-1.39209028e+00  5.71283980e-01]\n [ 4.57465767e-01  5.26568280e-01]]\nМетки класса: \n[0 1 0 1 0 1 0 0 1 0 1 0 1 1 1]\n"
        }
      ],
      "execution_count": 4
    },
    {
      "id": "52722b3e-1b24-4ca4-93b4-ef7a86aa9983",
      "cell_type": "code",
      "source": "plt.scatter (X[:,0], X[:,1], c=y)\nplt.show",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 5,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<function matplotlib.pyplot.show(close=None, block=None)>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 86192 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 5
    },
    {
      "id": "f5f9365a-a487-400d-9cb7-27f0bdceedff",
      "cell_type": "code",
      "source": "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 3)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 6
    },
    {
      "id": "c5e6c10b-86a4-45f0-887c-a9c1682018f0",
      "cell_type": "code",
      "source": "plt.figure(figsize=(7, 5))\n\n# Обучающая выборка\nplt.scatter(\n    X_train[:, 0], X_train[:, 1],\n    c=y_train,\n    label=\"train\"\n)\n\nplt.title(\"Обучающая выборка\")\nplt.xlabel(\"x1\")\nplt.ylabel(\"x2\")\nplt.grid(True, alpha=0.3)\nplt.show()",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 700x500 with 1 Axes>",
            "image/png": "[encoded data, 105092 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 7
    },
    {
      "id": "ffd8e14d-1825-4a6a-894d-6aca3bf4d69f",
      "cell_type": "code",
      "source": "plt.figure(figsize=(7, 5))\n\n# Тестовая выборка\nplt.scatter(\n    X_test[:, 0], X_test[:, 1],\n    c=y_test, \n    label=\"test\"\n)\n\nplt.title(\"Тестовая выборка\")\nplt.xlabel(\"x1\")\nplt.ylabel(\"x2\")\nplt.grid(True, alpha=0.3)\nplt.show()",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 700x500 with 1 Axes>",
            "image/png": "[encoded data, 63512 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 8
    },
    {
      "id": "505c396b-a837-4a7a-9924-2f3887fb4a82",
      "cell_type": "code",
      "source": "#RS_1",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 9
    },
    {
      "id": "ab5b2a09-6eb6-4b39-8b02-756b9afa8084",
      "cell_type": "code",
      "source": "knn = KNeighborsClassifier(n_neighbors=1, metric = 'euclidean')",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 10
    },
    {
      "id": "9e0dfcd4-f045-4c66-9f70-6ff6067e0809",
      "cell_type": "code",
      "source": "knn.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 11,
          "output_type": "execute_result",
          "data": {
            "text/plain": "KNeighborsClassifier(metric='euclidean', n_neighbors=1)",
            "text/html": "<style>#sk-container-id-1 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-1 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-1 pre {\n  padding: 0;\n}\n\n#sk-container-id-1 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-1 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-1 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-1 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-1 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-1 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-1 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-1 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-1 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-1 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-1 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-1 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-1 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-1 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-1 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-1 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-1 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-1 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-1 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-1 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-1 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-1 div.sk-label label.sk-toggleable__label,\n#sk-container-id-1 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-1 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-1 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-1 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-1 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-1 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-1 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-1 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-1 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-1 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-1 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-1 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>KNeighborsClassifier(metric=&#x27;euclidean&#x27;, n_neighbors=1)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>KNeighborsClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.neighbors.KNeighborsClassifier.html\">?<span>Documentation for KNeighborsClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_neighbors',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_neighbors&nbsp;</td>\n            <td class=\"value\">1</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('weights',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">weights&nbsp;</td>\n            <td class=\"value\">&#x27;uniform&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('algorithm',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">algorithm&nbsp;</td>\n            <td class=\"value\">&#x27;auto&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('leaf_size',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">leaf_size&nbsp;</td>\n            <td class=\"value\">30</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('p',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">p&nbsp;</td>\n            <td class=\"value\">2</td>\n        </tr>\n    \n\n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('metric',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">metric&nbsp;</td>\n            <td class=\"value\">&#x27;euclidean&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('metric_params',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">metric_params&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_jobs',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_jobs&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 11
    },
    {
      "id": "82f42e8a-6867-4042-9184-56e1beb00585",
      "cell_type": "code",
      "source": "prediction = knn.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 12
    },
    {
      "id": "857bc801-a975-44c2-94a1-513f90243480",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 0 1 1 1 0 1 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0\n 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 1\n 0 1 0 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0\n 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 0 1 0 0 1]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 13
    },
    {
      "id": "678d5592-8e14-4ac0-a985-393af82ce741",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[105  25]\n [ 18 102]]\n"
        }
      ],
      "execution_count": 14
    },
    {
      "id": "47a06468-dc56-49ae-a549-83154b3cd3b3",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.828\n"
        }
      ],
      "execution_count": 15
    },
    {
      "id": "a72446bc-4d47-4d42-81b5-0c9aeede1fbf",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.85      0.81      0.83       130\n           1       0.80      0.85      0.83       120\n\n    accuracy                           0.83       250\n   macro avg       0.83      0.83      0.83       250\nweighted avg       0.83      0.83      0.83       250\n\n"
        }
      ],
      "execution_count": 16
    },
    {
      "id": "2868db31-8b2f-48e0-be98-7bfae983ea68",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 17,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.8288461538461539"
          },
          "metadata": {}
        }
      ],
      "execution_count": 17
    },
    {
      "id": "75792327-acbf-4cda-bc4b-e1790e892a6b",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(knn, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 18,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0x9794e90>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 79904 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 18
    },
    {
      "id": "203caf9e-d039-48e6-8178-115a62c39d25",
      "cell_type": "code",
      "source": "#RS_3",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 19
    },
    {
      "id": "7ecd6f84-210d-429b-b4cd-569439f4dddb",
      "cell_type": "code",
      "source": "knn = KNeighborsClassifier(n_neighbors=3, metric = 'euclidean')",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 20
    },
    {
      "id": "457e8520-3003-4af3-ba96-ad3363039e00",
      "cell_type": "code",
      "source": "knn.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 21,
          "output_type": "execute_result",
          "data": {
            "text/plain": "KNeighborsClassifier(metric='euclidean', n_neighbors=3)",
            "text/html": "<style>#sk-container-id-2 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-2 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-2 pre {\n  padding: 0;\n}\n\n#sk-container-id-2 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-2 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-2 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-2 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-2 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-2 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-2 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-2 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-2 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-2 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-2 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-2 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-2 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-2 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-2 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-2 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-2 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-2 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-2 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-2 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-2 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-2 div.sk-label label.sk-toggleable__label,\n#sk-container-id-2 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-2 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-2 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-2 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-2 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-2 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-2 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-2 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-2 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-2 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-2 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-2 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>KNeighborsClassifier(metric=&#x27;euclidean&#x27;, n_neighbors=3)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" checked><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>KNeighborsClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.neighbors.KNeighborsClassifier.html\">?<span>Documentation for KNeighborsClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_neighbors',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_neighbors&nbsp;</td>\n            <td class=\"value\">3</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('weights',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">weights&nbsp;</td>\n            <td class=\"value\">&#x27;uniform&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('algorithm',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">algorithm&nbsp;</td>\n            <td class=\"value\">&#x27;auto&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('leaf_size',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">leaf_size&nbsp;</td>\n            <td class=\"value\">30</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('p',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">p&nbsp;</td>\n            <td class=\"value\">2</td>\n        </tr>\n    \n\n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('metric',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">metric&nbsp;</td>\n            <td class=\"value\">&#x27;euclidean&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('metric_params',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">metric_params&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_jobs',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_jobs&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 21
    },
    {
      "id": "f7cd41de-2868-4ad6-bea3-dfb63f142c50",
      "cell_type": "code",
      "source": "prediction = knn.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 22
    },
    {
      "id": "a5f0e649-7c13-4f43-a63f-2a565e1eb6b5",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 0 1\n 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1\n 0 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0\n 0 0 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 23
    },
    {
      "id": "ebe16eca-865c-4fff-90da-3331c8d42956",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[104  26]\n [  6 114]]\n"
        }
      ],
      "execution_count": 24
    },
    {
      "id": "ed79892b-31bf-48c5-aa9b-80be354af8bf",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.872\n"
        }
      ],
      "execution_count": 25
    },
    {
      "id": "af995fbe-a171-4ae5-affb-5a4c9aeab704",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.95      0.80      0.87       130\n           1       0.81      0.95      0.88       120\n\n    accuracy                           0.87       250\n   macro avg       0.88      0.88      0.87       250\nweighted avg       0.88      0.87      0.87       250\n\n"
        }
      ],
      "execution_count": 26
    },
    {
      "id": "d1cabf14-1402-40ac-944c-066e0039be72",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 27,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.875"
          },
          "metadata": {}
        }
      ],
      "execution_count": 27
    },
    {
      "id": "3deed264-b857-4611-9e3b-ad592f0bbb86",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(knn, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 28,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0x9906118>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 76964 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 28
    },
    {
      "id": "c2b6512e-f03f-44f3-83e9-d0cb53ff8b3c",
      "cell_type": "code",
      "source": "#RS_9",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 29
    },
    {
      "id": "ec803ed1-cd51-4203-a31c-5ecc03ac7080",
      "cell_type": "code",
      "source": "knn = KNeighborsClassifier(n_neighbors=9, metric = 'euclidean')",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 30
    },
    {
      "id": "74129495-ecd5-4d7a-b3bc-8d9031fb3f54",
      "cell_type": "code",
      "source": "knn.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 31,
          "output_type": "execute_result",
          "data": {
            "text/plain": "KNeighborsClassifier(metric='euclidean', n_neighbors=9)",
            "text/html": "<style>#sk-container-id-3 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-3 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-3 pre {\n  padding: 0;\n}\n\n#sk-container-id-3 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-3 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-3 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-3 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-3 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-3 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-3 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-3 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-3 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-3 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-3 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-3 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-3 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-3 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-3 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-3 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-3 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-3 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-3 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-3 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-3 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-3 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-3 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-3 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-3 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-3 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-3 div.sk-label label.sk-toggleable__label,\n#sk-container-id-3 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-3 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-3 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-3 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-3 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-3 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-3 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-3 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-3 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-3 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-3 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-3 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-3 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-3\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>KNeighborsClassifier(metric=&#x27;euclidean&#x27;, n_neighbors=9)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-3\" type=\"checkbox\" checked><label for=\"sk-estimator-id-3\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>KNeighborsClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.neighbors.KNeighborsClassifier.html\">?<span>Documentation for KNeighborsClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_neighbors',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_neighbors&nbsp;</td>\n            <td class=\"value\">9</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('weights',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">weights&nbsp;</td>\n            <td class=\"value\">&#x27;uniform&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('algorithm',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">algorithm&nbsp;</td>\n            <td class=\"value\">&#x27;auto&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('leaf_size',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">leaf_size&nbsp;</td>\n            <td class=\"value\">30</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('p',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">p&nbsp;</td>\n            <td class=\"value\">2</td>\n        </tr>\n    \n\n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('metric',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">metric&nbsp;</td>\n            <td class=\"value\">&#x27;euclidean&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('metric_params',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">metric_params&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_jobs',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_jobs&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 31
    },
    {
      "id": "96540f64-9ce0-4743-bf8f-6b7186ec93a1",
      "cell_type": "code",
      "source": "prediction = knn.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 32
    },
    {
      "id": "e4adfd8c-07b1-48dd-b257-e38be8aa95a6",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 1 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1\n 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1\n 0 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 0 0 0 1 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 33
    },
    {
      "id": "f32bdd33-f503-4a83-a615-47e83e6e127f",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[100  30]\n [  3 117]]\n"
        }
      ],
      "execution_count": 34
    },
    {
      "id": "9650f1a7-7cc0-40ee-beb4-ea49f8350f20",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.868\n"
        }
      ],
      "execution_count": 35
    },
    {
      "id": "4150be0e-34b5-4b27-9b97-ea1ed63120a5",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.97      0.77      0.86       130\n           1       0.80      0.97      0.88       120\n\n    accuracy                           0.87       250\n   macro avg       0.88      0.87      0.87       250\nweighted avg       0.89      0.87      0.87       250\n\n"
        }
      ],
      "execution_count": 36
    },
    {
      "id": "6a2a1650-34dd-4c7b-bec1-71ff7f0aec2e",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 37,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.8721153846153846"
          },
          "metadata": {}
        }
      ],
      "execution_count": 37
    },
    {
      "id": "e247bb52-4218-4a19-b4ed-b2a24ee92f1d",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(knn, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 38,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0x953b1f0>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 75252 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 38
    },
    {
      "id": "57a3e07d-6e27-4d19-82e3-6c2b0da1ecce",
      "cell_type": "code",
      "source": "#GaussianNB",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 39
    },
    {
      "id": "dacec649-0da0-4248-8b69-9f1de0865df8",
      "cell_type": "code",
      "source": "from sklearn.naive_bayes import GaussianNB",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 40
    },
    {
      "id": "e89f0c72-e8c7-49bc-a687-aba3df966cdc",
      "cell_type": "code",
      "source": "gnb=GaussianNB()",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 41
    },
    {
      "id": "6c3c9854-442c-420e-b7f5-b105958dd5ea",
      "cell_type": "code",
      "source": "gnb.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 42,
          "output_type": "execute_result",
          "data": {
            "text/plain": "GaussianNB()",
            "text/html": "<style>#sk-container-id-4 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-4 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-4 pre {\n  padding: 0;\n}\n\n#sk-container-id-4 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-4 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-4 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-4 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-4 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-4 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-4 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-4 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-4 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-4 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-4 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-4 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-4 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-4 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-4 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-4 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-4 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-4 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-4 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-4 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-4 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-4 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-4 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-4 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-4 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-4 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-4 div.sk-label label.sk-toggleable__label,\n#sk-container-id-4 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-4 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-4 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-4 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-4 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-4 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-4 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-4 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-4 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-4 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-4 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-4 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-4 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-4\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>GaussianNB()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-4\" type=\"checkbox\" checked><label for=\"sk-estimator-id-4\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>GaussianNB</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.naive_bayes.GaussianNB.html\">?<span>Documentation for GaussianNB</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('priors',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">priors&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('var_smoothing',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">var_smoothing&nbsp;</td>\n            <td class=\"value\">1e-09</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 42
    },
    {
      "id": "f379197e-5c30-436d-a6a7-5f2802d7cc21",
      "cell_type": "code",
      "source": "prediction = gnb.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 43
    },
    {
      "id": "c6c5da50-4d33-44ad-973f-af05016e1e15",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1\n 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1\n 0 1 0 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 44
    },
    {
      "id": "2bb2cbab-0358-49b5-b1ad-7e5bb957bbde",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[107  23]\n [  1 119]]\n"
        }
      ],
      "execution_count": 45
    },
    {
      "id": "be8e806a-5a07-4119-a477-849b7c71344c",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.904\n"
        }
      ],
      "execution_count": 46
    },
    {
      "id": "abeb2561-cfca-4b7f-a6e5-8da720e0a535",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.99      0.82      0.90       130\n           1       0.84      0.99      0.91       120\n\n    accuracy                           0.90       250\n   macro avg       0.91      0.91      0.90       250\nweighted avg       0.92      0.90      0.90       250\n\n"
        }
      ],
      "execution_count": 47
    },
    {
      "id": "f12f2dbb-ed28-4c5a-87d2-7734c2c1e68c",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 48,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.9073717948717948"
          },
          "metadata": {}
        }
      ],
      "execution_count": 48
    },
    {
      "id": "9cf4ded2-c46d-423a-8f61-0f8b4d4d8bfe",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(gnb, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 49,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0x9753278>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 64952 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 49
    },
    {
      "id": "d786fb40-89ce-4b1e-a3dd-1160c1697dbb",
      "cell_type": "code",
      "source": "#RandFor-5",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 50
    },
    {
      "id": "95df0e84-0a64-40bc-8908-19a886e4f7e9",
      "cell_type": "code",
      "source": "from sklearn.ensemble import RandomForestClassifier",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 51
    },
    {
      "id": "a0964f55-b395-45b7-841d-98070149912f",
      "cell_type": "code",
      "source": "rf=RandomForestClassifier(n_estimators=5,random_state=42)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 52
    },
    {
      "id": "7c7454a2-4e5d-40db-9423-fba594f62ae4",
      "cell_type": "code",
      "source": "rf.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 53,
          "output_type": "execute_result",
          "data": {
            "text/plain": "RandomForestClassifier(n_estimators=5, random_state=42)",
            "text/html": "<style>#sk-container-id-5 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-5 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-5 pre {\n  padding: 0;\n}\n\n#sk-container-id-5 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-5 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-5 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-5 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-5 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-5 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-5 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-5 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-5 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-5 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-5 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-5 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-5 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-5 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-5 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-5 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-5 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-5 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-5 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-5 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-5 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-5 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-5 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-5 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-5 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-5 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-5 div.sk-label label.sk-toggleable__label,\n#sk-container-id-5 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-5 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-5 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-5 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-5 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-5 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-5 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-5 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-5 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-5 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-5 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-5 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-5 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-5\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>RandomForestClassifier(n_estimators=5, random_state=42)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-5\" type=\"checkbox\" checked><label for=\"sk-estimator-id-5\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>RandomForestClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.ensemble.RandomForestClassifier.html\">?<span>Documentation for RandomForestClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_estimators',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_estimators&nbsp;</td>\n            <td class=\"value\">5</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('criterion',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">criterion&nbsp;</td>\n            <td class=\"value\">&#x27;gini&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_depth',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_depth&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_samples_split',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_samples_split&nbsp;</td>\n            <td class=\"value\">2</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_samples_leaf',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_samples_leaf&nbsp;</td>\n            <td class=\"value\">1</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_weight_fraction_leaf',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_weight_fraction_leaf&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_features',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_features&nbsp;</td>\n            <td class=\"value\">&#x27;sqrt&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_leaf_nodes',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_leaf_nodes&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_impurity_decrease',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_impurity_decrease&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('bootstrap',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">bootstrap&nbsp;</td>\n            <td class=\"value\">True</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('oob_score',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">oob_score&nbsp;</td>\n            <td class=\"value\">False</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_jobs',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_jobs&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('random_state',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">random_state&nbsp;</td>\n            <td class=\"value\">42</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('verbose',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">verbose&nbsp;</td>\n            <td class=\"value\">0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('warm_start',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">warm_start&nbsp;</td>\n            <td class=\"value\">False</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('class_weight',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">class_weight&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('ccp_alpha',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">ccp_alpha&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_samples',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_samples&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('monotonic_cst',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">monotonic_cst&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 53
    },
    {
      "id": "a8867b79-c126-4364-b7f5-d6f7b742d04e",
      "cell_type": "code",
      "source": "prediction = rf.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 54
    },
    {
      "id": "4a572642-e40b-4680-ae0f-77198bf1436e",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 1\n 0 0 1 0 0 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 1\n 0 1 0 0 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0\n 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 0]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 55
    },
    {
      "id": "c9295ec0-b569-497d-963d-2b46cf943700",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[107  23]\n [ 11 109]]\n"
        }
      ],
      "execution_count": 56
    },
    {
      "id": "b873247b-bdbc-4047-9cf6-656f3d8740fd",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.864\n"
        }
      ],
      "execution_count": 57
    },
    {
      "id": "d523786b-d691-4307-968b-6c0bf2c9ce64",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.91      0.82      0.86       130\n           1       0.83      0.91      0.87       120\n\n    accuracy                           0.86       250\n   macro avg       0.87      0.87      0.86       250\nweighted avg       0.87      0.86      0.86       250\n\n"
        }
      ],
      "execution_count": 58
    },
    {
      "id": "76c68c90-8e61-4de1-921b-66747ff5d0f1",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 59,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.8657051282051281"
          },
          "metadata": {}
        }
      ],
      "execution_count": 59
    },
    {
      "id": "57adb09c-c617-46c8-9072-b3e3f081d35e",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(rf, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 60,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0x9ff0788>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 67300 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 60
    },
    {
      "id": "b1c17709-9327-4a6b-9e33-0bf8d79e6ccb",
      "cell_type": "code",
      "source": "#RandFor-15",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 61
    },
    {
      "id": "82bdfda2-5a8d-4ef3-8436-0f624a93c005",
      "cell_type": "code",
      "source": "rf=RandomForestClassifier(n_estimators=15,random_state=42)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 62
    },
    {
      "id": "ee021415-871c-49d8-92d7-c22aff8d3f80",
      "cell_type": "code",
      "source": "rf.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 63,
          "output_type": "execute_result",
          "data": {
            "text/plain": "RandomForestClassifier(n_estimators=15, random_state=42)",
            "text/html": "<style>#sk-container-id-6 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-6 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-6 pre {\n  padding: 0;\n}\n\n#sk-container-id-6 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-6 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-6 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-6 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-6 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-6 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-6 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-6 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-6 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-6 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-6 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-6 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-6 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-6 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-6 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-6 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-6 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-6 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-6 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-6 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-6 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-6 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-6 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-6 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-6 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-6 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-6 div.sk-label label.sk-toggleable__label,\n#sk-container-id-6 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-6 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-6 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-6 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-6 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-6 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-6 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-6 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-6 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-6 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-6 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-6 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-6 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-6\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>RandomForestClassifier(n_estimators=15, random_state=42)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-6\" type=\"checkbox\" checked><label for=\"sk-estimator-id-6\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>RandomForestClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.ensemble.RandomForestClassifier.html\">?<span>Documentation for RandomForestClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_estimators',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_estimators&nbsp;</td>\n            <td class=\"value\">15</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('criterion',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">criterion&nbsp;</td>\n            <td class=\"value\">&#x27;gini&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_depth',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_depth&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_samples_split',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_samples_split&nbsp;</td>\n            <td class=\"value\">2</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_samples_leaf',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_samples_leaf&nbsp;</td>\n            <td class=\"value\">1</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_weight_fraction_leaf',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_weight_fraction_leaf&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_features',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_features&nbsp;</td>\n            <td class=\"value\">&#x27;sqrt&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_leaf_nodes',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_leaf_nodes&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_impurity_decrease',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_impurity_decrease&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('bootstrap',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">bootstrap&nbsp;</td>\n            <td class=\"value\">True</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('oob_score',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">oob_score&nbsp;</td>\n            <td class=\"value\">False</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_jobs',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_jobs&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('random_state',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">random_state&nbsp;</td>\n            <td class=\"value\">42</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('verbose',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">verbose&nbsp;</td>\n            <td class=\"value\">0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('warm_start',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">warm_start&nbsp;</td>\n            <td class=\"value\">False</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('class_weight',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">class_weight&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('ccp_alpha',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">ccp_alpha&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_samples',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_samples&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('monotonic_cst',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">monotonic_cst&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 63
    },
    {
      "id": "f4fe370a-b10a-4ed4-b0f8-272e632c612e",
      "cell_type": "code",
      "source": "prediction = rf.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 64
    },
    {
      "id": "e3ded4cd-045c-4660-ad99-287add294b0d",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 1 0 1\n 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0 0 1\n 0 1 0 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 65
    },
    {
      "id": "b516f3a3-6695-44cf-8008-519a91b51fbe",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[109  21]\n [  8 112]]\n"
        }
      ],
      "execution_count": 66
    },
    {
      "id": "b205cc78-d821-4fb9-a97d-3fb903dc3df0",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.884\n"
        }
      ],
      "execution_count": 67
    },
    {
      "id": "0ae981de-5559-4ea3-b1e4-f1564f9b9edd",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.93      0.84      0.88       130\n           1       0.84      0.93      0.89       120\n\n    accuracy                           0.88       250\n   macro avg       0.89      0.89      0.88       250\nweighted avg       0.89      0.88      0.88       250\n\n"
        }
      ],
      "execution_count": 68
    },
    {
      "id": "ecee820f-c51d-41ad-a67b-4aaa4ba48881",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 69,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.885897435897436"
          },
          "metadata": {}
        }
      ],
      "execution_count": 69
    },
    {
      "id": "657273c4-fbbc-4739-aaf1-cce86411b8bb",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(rf, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 70,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0xa303e60>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 67936 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 70
    },
    {
      "id": "b5d0bf24-49c9-4a33-8760-bc086f9e1bf9",
      "cell_type": "code",
      "source": "#RandFor-50",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 71
    },
    {
      "id": "d80adbec-43e1-4c6c-8856-36a3c3f51a85",
      "cell_type": "code",
      "source": "rf=RandomForestClassifier(n_estimators=50,random_state=42)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 72
    },
    {
      "id": "bd457cf0-47c7-4a48-8e6a-1e56877bd120",
      "cell_type": "code",
      "source": "rf.fit(X_train, y_train)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 73,
          "output_type": "execute_result",
          "data": {
            "text/plain": "RandomForestClassifier(n_estimators=50, random_state=42)",
            "text/html": "<style>#sk-container-id-7 {\n  /* Definition of color scheme common for light and dark mode */\n  --sklearn-color-text: #000;\n  --sklearn-color-text-muted: #666;\n  --sklearn-color-line: gray;\n  /* Definition of color scheme for unfitted estimators */\n  --sklearn-color-unfitted-level-0: #fff5e6;\n  --sklearn-color-unfitted-level-1: #f6e4d2;\n  --sklearn-color-unfitted-level-2: #ffe0b3;\n  --sklearn-color-unfitted-level-3: chocolate;\n  /* Definition of color scheme for fitted estimators */\n  --sklearn-color-fitted-level-0: #f0f8ff;\n  --sklearn-color-fitted-level-1: #d4ebff;\n  --sklearn-color-fitted-level-2: #b3dbfd;\n  --sklearn-color-fitted-level-3: cornflowerblue;\n\n  /* Specific color for light theme */\n  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n  --sklearn-color-icon: #696969;\n\n  @media (prefers-color-scheme: dark) {\n    /* Redefinition of color scheme for dark theme */\n    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n    --sklearn-color-icon: #878787;\n  }\n}\n\n#sk-container-id-7 {\n  color: var(--sklearn-color-text);\n}\n\n#sk-container-id-7 pre {\n  padding: 0;\n}\n\n#sk-container-id-7 input.sk-hidden--visually {\n  border: 0;\n  clip: rect(1px 1px 1px 1px);\n  clip: rect(1px, 1px, 1px, 1px);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  width: 1px;\n}\n\n#sk-container-id-7 div.sk-dashed-wrapped {\n  border: 1px dashed var(--sklearn-color-line);\n  margin: 0 0.4em 0.5em 0.4em;\n  box-sizing: border-box;\n  padding-bottom: 0.4em;\n  background-color: var(--sklearn-color-background);\n}\n\n#sk-container-id-7 div.sk-container {\n  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n     but bootstrap.min.css set `[hidden] { display: none !important; }`\n     so we also need the `!important` here to be able to override the\n     default hidden behavior on the sphinx rendered scikit-learn.org.\n     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n  display: inline-block !important;\n  position: relative;\n}\n\n#sk-container-id-7 div.sk-text-repr-fallback {\n  display: none;\n}\n\ndiv.sk-parallel-item,\ndiv.sk-serial,\ndiv.sk-item {\n  /* draw centered vertical line to link estimators */\n  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n  background-size: 2px 100%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n\n/* Parallel-specific style estimator block */\n\n#sk-container-id-7 div.sk-parallel-item::after {\n  content: \"\";\n  width: 100%;\n  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n  flex-grow: 1;\n}\n\n#sk-container-id-7 div.sk-parallel {\n  display: flex;\n  align-items: stretch;\n  justify-content: center;\n  background-color: var(--sklearn-color-background);\n  position: relative;\n}\n\n#sk-container-id-7 div.sk-parallel-item {\n  display: flex;\n  flex-direction: column;\n}\n\n#sk-container-id-7 div.sk-parallel-item:first-child::after {\n  align-self: flex-end;\n  width: 50%;\n}\n\n#sk-container-id-7 div.sk-parallel-item:last-child::after {\n  align-self: flex-start;\n  width: 50%;\n}\n\n#sk-container-id-7 div.sk-parallel-item:only-child::after {\n  width: 0;\n}\n\n/* Serial-specific style estimator block */\n\n#sk-container-id-7 div.sk-serial {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  background-color: var(--sklearn-color-background);\n  padding-right: 1em;\n  padding-left: 1em;\n}\n\n\n/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\nclickable and can be expanded/collapsed.\n- Pipeline and ColumnTransformer use this feature and define the default style\n- Estimators will overwrite some part of the style using the `sk-estimator` class\n*/\n\n/* Pipeline and ColumnTransformer style (default) */\n\n#sk-container-id-7 div.sk-toggleable {\n  /* Default theme specific background. It is overwritten whether we have a\n  specific estimator or a Pipeline/ColumnTransformer */\n  background-color: var(--sklearn-color-background);\n}\n\n/* Toggleable label */\n#sk-container-id-7 label.sk-toggleable__label {\n  cursor: pointer;\n  display: flex;\n  width: 100%;\n  margin-bottom: 0;\n  padding: 0.5em;\n  box-sizing: border-box;\n  text-align: center;\n  align-items: start;\n  justify-content: space-between;\n  gap: 0.5em;\n}\n\n#sk-container-id-7 label.sk-toggleable__label .caption {\n  font-size: 0.6rem;\n  font-weight: lighter;\n  color: var(--sklearn-color-text-muted);\n}\n\n#sk-container-id-7 label.sk-toggleable__label-arrow:before {\n  /* Arrow on the left of the label */\n  content: \"▸\";\n  float: left;\n  margin-right: 0.25em;\n  color: var(--sklearn-color-icon);\n}\n\n#sk-container-id-7 label.sk-toggleable__label-arrow:hover:before {\n  color: var(--sklearn-color-text);\n}\n\n/* Toggleable content - dropdown */\n\n#sk-container-id-7 div.sk-toggleable__content {\n  display: none;\n  text-align: left;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-7 div.sk-toggleable__content.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-7 div.sk-toggleable__content pre {\n  margin: 0.2em;\n  border-radius: 0.25em;\n  color: var(--sklearn-color-text);\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-7 div.sk-toggleable__content.fitted pre {\n  /* unfitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n#sk-container-id-7 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n  /* Expand drop-down */\n  display: block;\n  width: 100%;\n  overflow: visible;\n}\n\n#sk-container-id-7 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n  content: \"▾\";\n}\n\n/* Pipeline/ColumnTransformer-specific style */\n\n#sk-container-id-7 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-7 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator-specific style */\n\n/* Colorize estimator box */\n#sk-container-id-7 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-7 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n#sk-container-id-7 div.sk-label label.sk-toggleable__label,\n#sk-container-id-7 div.sk-label label {\n  /* The background is the default theme color */\n  color: var(--sklearn-color-text-on-default-background);\n}\n\n/* On hover, darken the color of the background */\n#sk-container-id-7 div.sk-label:hover label.sk-toggleable__label {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n/* Label box, darken color on hover, fitted */\n#sk-container-id-7 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n  color: var(--sklearn-color-text);\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Estimator label */\n\n#sk-container-id-7 div.sk-label label {\n  font-family: monospace;\n  font-weight: bold;\n  display: inline-block;\n  line-height: 1.2em;\n}\n\n#sk-container-id-7 div.sk-label-container {\n  text-align: center;\n}\n\n/* Estimator-specific */\n#sk-container-id-7 div.sk-estimator {\n  font-family: monospace;\n  border: 1px dotted var(--sklearn-color-border-box);\n  border-radius: 0.25em;\n  box-sizing: border-box;\n  margin-bottom: 0.5em;\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-0);\n}\n\n#sk-container-id-7 div.sk-estimator.fitted {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-0);\n}\n\n/* on hover */\n#sk-container-id-7 div.sk-estimator:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-2);\n}\n\n#sk-container-id-7 div.sk-estimator.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-2);\n}\n\n/* Specification for estimator info (e.g. \"i\" and \"?\") */\n\n/* Common style for \"i\" and \"?\" */\n\n.sk-estimator-doc-link,\na:link.sk-estimator-doc-link,\na:visited.sk-estimator-doc-link {\n  float: right;\n  font-size: smaller;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1em;\n  height: 1em;\n  width: 1em;\n  text-decoration: none !important;\n  margin-left: 0.5em;\n  text-align: center;\n  /* unfitted */\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n  color: var(--sklearn-color-unfitted-level-1);\n}\n\n.sk-estimator-doc-link.fitted,\na:link.sk-estimator-doc-link.fitted,\na:visited.sk-estimator-doc-link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\ndiv.sk-estimator:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link:hover,\n.sk-estimator-doc-link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\ndiv.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover,\ndiv.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n.sk-estimator-doc-link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n/* Span, style for the box shown on hovering the info icon */\n.sk-estimator-doc-link span {\n  display: none;\n  z-index: 9999;\n  position: relative;\n  font-weight: normal;\n  right: .2ex;\n  padding: .5ex;\n  margin: .5ex;\n  width: min-content;\n  min-width: 20ex;\n  max-width: 50ex;\n  color: var(--sklearn-color-text);\n  box-shadow: 2pt 2pt 4pt #999;\n  /* unfitted */\n  background: var(--sklearn-color-unfitted-level-0);\n  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n}\n\n.sk-estimator-doc-link.fitted span {\n  /* fitted */\n  background: var(--sklearn-color-fitted-level-0);\n  border: var(--sklearn-color-fitted-level-3);\n}\n\n.sk-estimator-doc-link:hover span {\n  display: block;\n}\n\n/* \"?\"-specific style due to the `<a>` HTML tag */\n\n#sk-container-id-7 a.estimator_doc_link {\n  float: right;\n  font-size: 1rem;\n  line-height: 1em;\n  font-family: monospace;\n  background-color: var(--sklearn-color-background);\n  border-radius: 1rem;\n  height: 1rem;\n  width: 1rem;\n  text-decoration: none;\n  /* unfitted */\n  color: var(--sklearn-color-unfitted-level-1);\n  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n}\n\n#sk-container-id-7 a.estimator_doc_link.fitted {\n  /* fitted */\n  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n  color: var(--sklearn-color-fitted-level-1);\n}\n\n/* On hover */\n#sk-container-id-7 a.estimator_doc_link:hover {\n  /* unfitted */\n  background-color: var(--sklearn-color-unfitted-level-3);\n  color: var(--sklearn-color-background);\n  text-decoration: none;\n}\n\n#sk-container-id-7 a.estimator_doc_link.fitted:hover {\n  /* fitted */\n  background-color: var(--sklearn-color-fitted-level-3);\n}\n\n.estimator-table summary {\n    padding: .5rem;\n    font-family: monospace;\n    cursor: pointer;\n}\n\n.estimator-table details[open] {\n    padding-left: 0.1rem;\n    padding-right: 0.1rem;\n    padding-bottom: 0.3rem;\n}\n\n.estimator-table .parameters-table {\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.estimator-table .parameters-table tr:nth-child(odd) {\n    background-color: #fff;\n}\n\n.estimator-table .parameters-table tr:nth-child(even) {\n    background-color: #f6f6f6;\n}\n\n.estimator-table .parameters-table tr:hover {\n    background-color: #e0e0e0;\n}\n\n.estimator-table table td {\n    border: 1px solid rgba(106, 105, 104, 0.232);\n}\n\n.user-set td {\n    color:rgb(255, 94, 0);\n    text-align: left;\n}\n\n.user-set td.value pre {\n    color:rgb(255, 94, 0) !important;\n    background-color: transparent !important;\n}\n\n.default td {\n    color: black;\n    text-align: left;\n}\n\n.user-set td i,\n.default td i {\n    color: black;\n}\n\n.copy-paste-icon {\n    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n    background-repeat: no-repeat;\n    background-size: 14px 14px;\n    background-position: 0;\n    display: inline-block;\n    width: 14px;\n    height: 14px;\n    cursor: pointer;\n}\n</style><body><div id=\"sk-container-id-7\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>RandomForestClassifier(n_estimators=50, random_state=42)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-7\" type=\"checkbox\" checked><label for=\"sk-estimator-id-7\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>RandomForestClassifier</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.7/modules/generated/sklearn.ensemble.RandomForestClassifier.html\">?<span>Documentation for RandomForestClassifier</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n        <div class=\"estimator-table\">\n            <details>\n                <summary>Parameters</summary>\n                <table class=\"parameters-table\">\n                  <tbody>\n                    \n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_estimators',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_estimators&nbsp;</td>\n            <td class=\"value\">50</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('criterion',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">criterion&nbsp;</td>\n            <td class=\"value\">&#x27;gini&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_depth',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_depth&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_samples_split',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_samples_split&nbsp;</td>\n            <td class=\"value\">2</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_samples_leaf',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_samples_leaf&nbsp;</td>\n            <td class=\"value\">1</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_weight_fraction_leaf',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_weight_fraction_leaf&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_features',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_features&nbsp;</td>\n            <td class=\"value\">&#x27;sqrt&#x27;</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_leaf_nodes',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_leaf_nodes&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('min_impurity_decrease',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">min_impurity_decrease&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('bootstrap',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">bootstrap&nbsp;</td>\n            <td class=\"value\">True</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('oob_score',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">oob_score&nbsp;</td>\n            <td class=\"value\">False</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('n_jobs',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">n_jobs&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"user-set\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('random_state',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">random_state&nbsp;</td>\n            <td class=\"value\">42</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('verbose',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">verbose&nbsp;</td>\n            <td class=\"value\">0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('warm_start',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">warm_start&nbsp;</td>\n            <td class=\"value\">False</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('class_weight',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">class_weight&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('ccp_alpha',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">ccp_alpha&nbsp;</td>\n            <td class=\"value\">0.0</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('max_samples',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">max_samples&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n\n        <tr class=\"default\">\n            <td><i class=\"copy-paste-icon\"\n                 onclick=\"copyToClipboard('monotonic_cst',\n                          this.parentElement.nextElementSibling)\"\n            ></i></td>\n            <td class=\"param\">monotonic_cst&nbsp;</td>\n            <td class=\"value\">None</td>\n        </tr>\n    \n                  </tbody>\n                </table>\n            </details>\n        </div>\n    </div></div></div></div></div><script>function copyToClipboard(text, element) {\n    // Get the parameter prefix from the closest toggleable content\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n\n    const originalStyle = element.style;\n    const computedStyle = window.getComputedStyle(element);\n    const originalWidth = computedStyle.width;\n    const originalHTML = element.innerHTML.replace('Copied!', '');\n\n    navigator.clipboard.writeText(fullParamName)\n        .then(() => {\n            element.style.width = originalWidth;\n            element.style.color = 'green';\n            element.innerHTML = \"Copied!\";\n\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        })\n        .catch(err => {\n            console.error('Failed to copy:', err);\n            element.style.color = 'red';\n            element.innerHTML = \"Failed!\";\n            setTimeout(() => {\n                element.innerHTML = originalHTML;\n                element.style = originalStyle;\n            }, 2000);\n        });\n    return false;\n}\n\ndocument.querySelectorAll('.fa-regular.fa-copy').forEach(function(element) {\n    const toggleableContent = element.closest('.sk-toggleable__content');\n    const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n    const paramName = element.parentElement.nextElementSibling.textContent.trim();\n    const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n\n    element.setAttribute('title', fullParamName);\n});\n</script></body>"
          },
          "metadata": {}
        }
      ],
      "execution_count": 73
    },
    {
      "id": "6d27f0d0-4515-4ab7-9d02-e6189448918d",
      "cell_type": "code",
      "source": "prediction = rf.predict(X_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": 74
    },
    {
      "id": "6c19ec0b-51e4-49bc-8540-3b92465e4f61",
      "cell_type": "code",
      "source": "print ('Prediction and test: ')\nprint (prediction)\nprint (y_test)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Prediction and test: \n[1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 1 0 1 0 1\n 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1\n 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1\n 0 1 0 0 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n[1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1\n 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0\n 0 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1\n 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1\n 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1\n 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0\n 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1]\n"
        }
      ],
      "execution_count": 75
    },
    {
      "id": "e466dddd-067c-406f-bdb8-56c43e3e24db",
      "cell_type": "code",
      "source": "print ('Confusion matrix: ')\nprint (confusion_matrix(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Confusion matrix: \n[[110  20]\n [  9 111]]\n"
        }
      ],
      "execution_count": 76
    },
    {
      "id": "2aaa9a1e-097a-452d-aea2-e21fc436e832",
      "cell_type": "code",
      "source": "print ('Accuracy score: ', accuracy_score(prediction, y_test))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "Accuracy score:  0.884\n"
        }
      ],
      "execution_count": 77
    },
    {
      "id": "167100bd-2756-487a-933a-8e41a4c08fb5",
      "cell_type": "code",
      "source": "print(classification_report(y_test, prediction))",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": "              precision    recall  f1-score   support\n\n           0       0.92      0.85      0.88       130\n           1       0.85      0.93      0.88       120\n\n    accuracy                           0.88       250\n   macro avg       0.89      0.89      0.88       250\nweighted avg       0.89      0.88      0.88       250\n\n"
        }
      ],
      "execution_count": 78
    },
    {
      "id": "00c100db-a9ba-4304-bf23-23106f296d68",
      "cell_type": "code",
      "source": "roc_auc_score(y_test, prediction)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 79,
          "output_type": "execute_result",
          "data": {
            "text/plain": "0.885576923076923"
          },
          "metadata": {}
        }
      ],
      "execution_count": 79
    },
    {
      "id": "4dca6ea1-f7d5-4197-9c5e-b1e9b4ef02b1",
      "cell_type": "code",
      "source": "plt.xlabel(\"first feature\")\nplt.ylabel(\"second feature\")\nplot_2d_separator(rf, X, fill=True)\nplt.scatter(X[:, 0], X[:, 1], c=y, s=70)",
      "metadata": {
        "trusted": true
      },
      "outputs": [
        {
          "execution_count": 80,
          "output_type": "execute_result",
          "data": {
            "text/plain": "<matplotlib.collections.PathCollection at 0xa4bb060>"
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": "<Figure size 640x480 with 1 Axes>",
            "image/png": "[encoded data, 67692 characters]"
          },
          "metadata": {}
        }
      ],
      "execution_count": 80
    },
    {
      "id": "4946602b-d925-4b33-9187-635ba2ae197c",
      "cell_type": "code",
      "source": "",
      "metadata": {
        "trusted": true
      },
      "outputs": [],
      "execution_count": null
    }
  ]
}