diff --git "a/machine_failure_prediction.ipynb" "b/machine_failure_prediction.ipynb"
new file mode 100644--- /dev/null
+++ "b/machine_failure_prediction.ipynb"
@@ -0,0 +1,1981 @@
+{
+  "cells": [
+    {
+      "cell_type": "markdown",
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "a6a69339-37e8-4cb6-863a-858e6df8872f",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "o5Iixw4vHWG9"
+      },
+      "source": [
+        "# Objective\n",
+        "\n",
+        "To illustrate a supervised learning workflow for classification tasks."
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "f3a9806a-355a-41fe-9b2a-0bda43aedd4e",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "niLZjnkCHWG_"
+      },
+      "source": [
+        "\n",
+        "# Setup"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "69c6950d-190a-4c7d-a5a2-a42164f4833b",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "SEBLSdL-HWHA"
+      },
+      "outputs": [],
+      "source": [
+        "import sklearn\n",
+        "import joblib\n",
+        "\n",
+        "from sklearn.datasets import fetch_openml\n",
+        "\n",
+        "from sklearn.preprocessing import StandardScaler, OneHotEncoder\n",
+        "from sklearn.compose import make_column_transformer\n",
+        "\n",
+        "from sklearn.pipeline import make_pipeline\n",
+        "\n",
+        "from sklearn.model_selection import train_test_split, RandomizedSearchCV\n",
+        "\n",
+        "from sklearn.linear_model import LogisticRegression\n",
+        "from sklearn.metrics import accuracy_score, classification_report"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "d006e342-db1e-42d7-95e1-7cfed889cb59",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "kzG9kVi4HWHB"
+      },
+      "outputs": [],
+      "source": [
+        "sklearn.set_config(display='diagram')"
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "28fdb1c5-213d-4bfc-bf78-c14c60f0f365",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "bQrbzi5RHWHC"
+      },
+      "source": [
+        "# Data"
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "For this session consider the case of predicting machinery failure based on the quality of the machinery and its wear and tear. Such predictions often require an expert intervention on the shopfloor and result in high dependencies on the expert."
+      ],
+      "metadata": {
+        "id": "knJjGZz-QVbr"
+      }
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "de73d795-30fe-4891-8a22-2356863aaef3",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "h5ZOCZjlHWHC"
+      },
+      "outputs": [],
+      "source": [
+        "dataset = fetch_openml(data_id=42890, as_frame=True, parser=\"auto\")"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "11e65af7-7b11-40fb-acf1-8c253e269ac6",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "gZ9nYAyJHWHD"
+      },
+      "outputs": [],
+      "source": [
+        "data_df = dataset.data"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "20762caf-3731-4797-9fd2-8400061aae8a",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "Y_tEmVPFHWHD"
+      },
+      "outputs": [],
+      "source": [
+        "target = 'Machine failure'\n",
+        "numeric_features = [\n",
+        "    'Air temperature [K]',\n",
+        "    'Process temperature [K]',\n",
+        "    'Rotational speed [rpm]',\n",
+        "    'Torque [Nm]',\n",
+        "    'Tool wear [min]'\n",
+        "]\n",
+        "categorical_features = ['Type']"
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "## Attribute Information:\n",
+        "\n",
+        "The dataset consists of 10 000 data points stored as rows with 14 features in columns\n",
+        "\n",
+        "- UID: unique identifier ranging from 1 to 10000\n",
+        "- product ID: consisting of a letter L, M, or H for low (50% of all products), medium (30%) and high (20%) as product quality variants and a variant-specific serial number\n",
+        "- air temperature [K]: generated using a random walk process later normalized to a standard deviation of 2 K around 300 K\n",
+        "- process temperature [K]: generated using a random walk process normalized to a standard deviation of 1 K, added to the air temperature plus 10 K.\n",
+        "- rotational speed [rpm]: calculated from a power of 2860 W, overlaid with a normally distributed noise\n",
+        "- torque [Nm]: torque values are normally distributed around 40 Nm with a f = 10 Nm and no negative values.\n",
+        "- tool wear [min]: The quality variants H/M/L add 5/3/2 minutes of tool wear to the used tool in the process.\n",
+        "- 'machine failure' label that indicates, whether the machine has failed in this particular datapoint for any of the following failure modes are true.\n",
+        "\n",
+        "The machine failure consists of five independent failure modes\n",
+        "tool wear failure (TWF): the tool will be replaced of fail at a randomly selected tool wear time between 200-240 mins (120 times in our dataset). At this point in time, the tool is replaced 69 times, and fails 51 times (randomly assigned).\n",
+        "\n",
+        "- heat dissipation failure (HDF): heat dissipation causes a process failure, if the difference between air- and process temperature is below 8.6 K and the tools rotational speed is below 1380 rpm. This is the case for 115 data points.\n",
+        "- power failure (PWF): the product of torque and rotational speed (in rad/s) equals the power required for the process. If this power is below 3500 W or above 9000 W, the process fails, which is the case 95 times in our dataset.\n",
+        "- overstrain failure (OSF): if the product of tool wear and torque exceeds 11,000 minNm for the L product variant (12,000 M, 13,000 H), the process fails due to overstrain. This is true for 98 datapoints.\n",
+        "- random failures (RNF): each process has a chance of 0,1 % to fail regardless of its process parameters. This is the case for only 5 datapoints, less than could be expected for 10,000 datapoints in our dataset.\n",
+        "\n",
+        "If at least one of the above failure modes is true, the process fails and the 'machine failure' label is set to 1."
+      ],
+      "metadata": {
+        "id": "tTN4lzHJQaXR"
+      }
+    },
+    {
+      "cell_type": "markdown",
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "c1f6d4b1-8956-4c8c-99c6-f616b6ffbbb7",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "iT25LmvoHWHD"
+      },
+      "source": [
+        "# EDA"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "13f93578-a8e7-4cd1-b599-af01cde98947",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "pRTCdlYTHWHD",
+        "outputId": "ae108d43-1a7c-46ea-ecf3-bb1952554fd2",
+        "colab": {
+          "base_uri": "https://localhost:8080/",
+          "height": 300
+        }
+      },
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "       Air temperature [K]  Process temperature [K]  Rotational speed [rpm]  \\\n",
+              "count         10000.000000             10000.000000            10000.000000   \n",
+              "mean            300.004930               310.005560             1538.776100   \n",
+              "std               2.000259                 1.483734              179.284096   \n",
+              "min             295.300000               305.700000             1168.000000   \n",
+              "25%             298.300000               308.800000             1423.000000   \n",
+              "50%             300.100000               310.100000             1503.000000   \n",
+              "75%             301.500000               311.100000             1612.000000   \n",
+              "max             304.500000               313.800000             2886.000000   \n",
+              "\n",
+              "        Torque [Nm]  Tool wear [min]  \n",
+              "count  10000.000000     10000.000000  \n",
+              "mean      39.986910       107.951000  \n",
+              "std        9.968934        63.654147  \n",
+              "min        3.800000         0.000000  \n",
+              "25%       33.200000        53.000000  \n",
+              "50%       40.100000       108.000000  \n",
+              "75%       46.800000       162.000000  \n",
+              "max       76.600000       253.000000  "
+            ],
+            "text/html": [
+              "\n",
+              "  <div id=\"df-75c6e5b0-a399-4539-a17b-af872411bac5\" class=\"colab-df-container\">\n",
+              "    <div>\n",
+              "<style scoped>\n",
+              "    .dataframe tbody tr th:only-of-type {\n",
+              "        vertical-align: middle;\n",
+              "    }\n",
+              "\n",
+              "    .dataframe tbody tr th {\n",
+              "        vertical-align: top;\n",
+              "    }\n",
+              "\n",
+              "    .dataframe thead th {\n",
+              "        text-align: right;\n",
+              "    }\n",
+              "</style>\n",
+              "<table border=\"1\" class=\"dataframe\">\n",
+              "  <thead>\n",
+              "    <tr style=\"text-align: right;\">\n",
+              "      <th></th>\n",
+              "      <th>Air temperature [K]</th>\n",
+              "      <th>Process temperature [K]</th>\n",
+              "      <th>Rotational speed [rpm]</th>\n",
+              "      <th>Torque [Nm]</th>\n",
+              "      <th>Tool wear [min]</th>\n",
+              "    </tr>\n",
+              "  </thead>\n",
+              "  <tbody>\n",
+              "    <tr>\n",
+              "      <th>count</th>\n",
+              "      <td>10000.000000</td>\n",
+              "      <td>10000.000000</td>\n",
+              "      <td>10000.000000</td>\n",
+              "      <td>10000.000000</td>\n",
+              "      <td>10000.000000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>mean</th>\n",
+              "      <td>300.004930</td>\n",
+              "      <td>310.005560</td>\n",
+              "      <td>1538.776100</td>\n",
+              "      <td>39.986910</td>\n",
+              "      <td>107.951000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>std</th>\n",
+              "      <td>2.000259</td>\n",
+              "      <td>1.483734</td>\n",
+              "      <td>179.284096</td>\n",
+              "      <td>9.968934</td>\n",
+              "      <td>63.654147</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>min</th>\n",
+              "      <td>295.300000</td>\n",
+              "      <td>305.700000</td>\n",
+              "      <td>1168.000000</td>\n",
+              "      <td>3.800000</td>\n",
+              "      <td>0.000000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>25%</th>\n",
+              "      <td>298.300000</td>\n",
+              "      <td>308.800000</td>\n",
+              "      <td>1423.000000</td>\n",
+              "      <td>33.200000</td>\n",
+              "      <td>53.000000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>50%</th>\n",
+              "      <td>300.100000</td>\n",
+              "      <td>310.100000</td>\n",
+              "      <td>1503.000000</td>\n",
+              "      <td>40.100000</td>\n",
+              "      <td>108.000000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>75%</th>\n",
+              "      <td>301.500000</td>\n",
+              "      <td>311.100000</td>\n",
+              "      <td>1612.000000</td>\n",
+              "      <td>46.800000</td>\n",
+              "      <td>162.000000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>max</th>\n",
+              "      <td>304.500000</td>\n",
+              "      <td>313.800000</td>\n",
+              "      <td>2886.000000</td>\n",
+              "      <td>76.600000</td>\n",
+              "      <td>253.000000</td>\n",
+              "    </tr>\n",
+              "  </tbody>\n",
+              "</table>\n",
+              "</div>\n",
+              "    <div class=\"colab-df-buttons\">\n",
+              "\n",
+              "  <div class=\"colab-df-container\">\n",
+              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-75c6e5b0-a399-4539-a17b-af872411bac5')\"\n",
+              "            title=\"Convert this dataframe to an interactive table.\"\n",
+              "            style=\"display:none;\">\n",
+              "\n",
+              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
+              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
+              "  </svg>\n",
+              "    </button>\n",
+              "\n",
+              "  <style>\n",
+              "    .colab-df-container {\n",
+              "      display:flex;\n",
+              "      gap: 12px;\n",
+              "    }\n",
+              "\n",
+              "    .colab-df-convert {\n",
+              "      background-color: #E8F0FE;\n",
+              "      border: none;\n",
+              "      border-radius: 50%;\n",
+              "      cursor: pointer;\n",
+              "      display: none;\n",
+              "      fill: #1967D2;\n",
+              "      height: 32px;\n",
+              "      padding: 0 0 0 0;\n",
+              "      width: 32px;\n",
+              "    }\n",
+              "\n",
+              "    .colab-df-convert:hover {\n",
+              "      background-color: #E2EBFA;\n",
+              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
+              "      fill: #174EA6;\n",
+              "    }\n",
+              "\n",
+              "    .colab-df-buttons div {\n",
+              "      margin-bottom: 4px;\n",
+              "    }\n",
+              "\n",
+              "    [theme=dark] .colab-df-convert {\n",
+              "      background-color: #3B4455;\n",
+              "      fill: #D2E3FC;\n",
+              "    }\n",
+              "\n",
+              "    [theme=dark] .colab-df-convert:hover {\n",
+              "      background-color: #434B5C;\n",
+              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
+              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
+              "      fill: #FFFFFF;\n",
+              "    }\n",
+              "  </style>\n",
+              "\n",
+              "    <script>\n",
+              "      const buttonEl =\n",
+              "        document.querySelector('#df-75c6e5b0-a399-4539-a17b-af872411bac5 button.colab-df-convert');\n",
+              "      buttonEl.style.display =\n",
+              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
+              "\n",
+              "      async function convertToInteractive(key) {\n",
+              "        const element = document.querySelector('#df-75c6e5b0-a399-4539-a17b-af872411bac5');\n",
+              "        const dataTable =\n",
+              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
+              "                                                    [key], {});\n",
+              "        if (!dataTable) return;\n",
+              "\n",
+              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
+              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
+              "          + ' to learn more about interactive tables.';\n",
+              "        element.innerHTML = '';\n",
+              "        dataTable['output_type'] = 'display_data';\n",
+              "        await google.colab.output.renderOutput(dataTable, element);\n",
+              "        const docLink = document.createElement('div');\n",
+              "        docLink.innerHTML = docLinkHtml;\n",
+              "        element.appendChild(docLink);\n",
+              "      }\n",
+              "    </script>\n",
+              "  </div>\n",
+              "\n",
+              "\n",
+              "<div id=\"df-a987b662-df7b-4f3e-89b7-716a5484c84e\">\n",
+              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-a987b662-df7b-4f3e-89b7-716a5484c84e')\"\n",
+              "            title=\"Suggest charts\"\n",
+              "            style=\"display:none;\">\n",
+              "\n",
+              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
+              "     width=\"24px\">\n",
+              "    <g>\n",
+              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
+              "    </g>\n",
+              "</svg>\n",
+              "  </button>\n",
+              "\n",
+              "<style>\n",
+              "  .colab-df-quickchart {\n",
+              "      --bg-color: #E8F0FE;\n",
+              "      --fill-color: #1967D2;\n",
+              "      --hover-bg-color: #E2EBFA;\n",
+              "      --hover-fill-color: #174EA6;\n",
+              "      --disabled-fill-color: #AAA;\n",
+              "      --disabled-bg-color: #DDD;\n",
+              "  }\n",
+              "\n",
+              "  [theme=dark] .colab-df-quickchart {\n",
+              "      --bg-color: #3B4455;\n",
+              "      --fill-color: #D2E3FC;\n",
+              "      --hover-bg-color: #434B5C;\n",
+              "      --hover-fill-color: #FFFFFF;\n",
+              "      --disabled-bg-color: #3B4455;\n",
+              "      --disabled-fill-color: #666;\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-quickchart {\n",
+              "    background-color: var(--bg-color);\n",
+              "    border: none;\n",
+              "    border-radius: 50%;\n",
+              "    cursor: pointer;\n",
+              "    display: none;\n",
+              "    fill: var(--fill-color);\n",
+              "    height: 32px;\n",
+              "    padding: 0;\n",
+              "    width: 32px;\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-quickchart:hover {\n",
+              "    background-color: var(--hover-bg-color);\n",
+              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
+              "    fill: var(--button-hover-fill-color);\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-quickchart-complete:disabled,\n",
+              "  .colab-df-quickchart-complete:disabled:hover {\n",
+              "    background-color: var(--disabled-bg-color);\n",
+              "    fill: var(--disabled-fill-color);\n",
+              "    box-shadow: none;\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-spinner {\n",
+              "    border: 2px solid var(--fill-color);\n",
+              "    border-color: transparent;\n",
+              "    border-bottom-color: var(--fill-color);\n",
+              "    animation:\n",
+              "      spin 1s steps(1) infinite;\n",
+              "  }\n",
+              "\n",
+              "  @keyframes spin {\n",
+              "    0% {\n",
+              "      border-color: transparent;\n",
+              "      border-bottom-color: var(--fill-color);\n",
+              "      border-left-color: var(--fill-color);\n",
+              "    }\n",
+              "    20% {\n",
+              "      border-color: transparent;\n",
+              "      border-left-color: var(--fill-color);\n",
+              "      border-top-color: var(--fill-color);\n",
+              "    }\n",
+              "    30% {\n",
+              "      border-color: transparent;\n",
+              "      border-left-color: var(--fill-color);\n",
+              "      border-top-color: var(--fill-color);\n",
+              "      border-right-color: var(--fill-color);\n",
+              "    }\n",
+              "    40% {\n",
+              "      border-color: transparent;\n",
+              "      border-right-color: var(--fill-color);\n",
+              "      border-top-color: var(--fill-color);\n",
+              "    }\n",
+              "    60% {\n",
+              "      border-color: transparent;\n",
+              "      border-right-color: var(--fill-color);\n",
+              "    }\n",
+              "    80% {\n",
+              "      border-color: transparent;\n",
+              "      border-right-color: var(--fill-color);\n",
+              "      border-bottom-color: var(--fill-color);\n",
+              "    }\n",
+              "    90% {\n",
+              "      border-color: transparent;\n",
+              "      border-bottom-color: var(--fill-color);\n",
+              "    }\n",
+              "  }\n",
+              "</style>\n",
+              "\n",
+              "  <script>\n",
+              "    async function quickchart(key) {\n",
+              "      const quickchartButtonEl =\n",
+              "        document.querySelector('#' + key + ' button');\n",
+              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
+              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
+              "      try {\n",
+              "        const charts = await google.colab.kernel.invokeFunction(\n",
+              "            'suggestCharts', [key], {});\n",
+              "      } catch (error) {\n",
+              "        console.error('Error during call to suggestCharts:', error);\n",
+              "      }\n",
+              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
+              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
+              "    }\n",
+              "    (() => {\n",
+              "      let quickchartButtonEl =\n",
+              "        document.querySelector('#df-a987b662-df7b-4f3e-89b7-716a5484c84e button');\n",
+              "      quickchartButtonEl.style.display =\n",
+              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
+              "    })();\n",
+              "  </script>\n",
+              "</div>\n",
+              "\n",
+              "    </div>\n",
+              "  </div>\n"
+            ],
+            "application/vnd.google.colaboratory.intrinsic+json": {
+              "type": "dataframe",
+              "summary": "{\n  \"name\": \"data_df[numeric_features]\",\n  \"rows\": 8,\n  \"fields\": [\n    {\n      \"column\": \"Air temperature [K]\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 3446.1125878918356,\n        \"min\": 2.000258682915751,\n        \"max\": 10000.0,\n        \"num_unique_values\": 8,\n        \"samples\": [\n          300.00493,\n          300.1,\n          10000.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Process temperature [K]\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 3443.232448462189,\n        \"min\": 1.4837342191657208,\n        \"max\": 10000.0,\n        \"num_unique_values\": 8,\n        \"samples\": [\n          310.00556,\n          310.1,\n          10000.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Rotational speed [rpm]\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 3103.301433905864,\n        \"min\": 179.2840959134266,\n        \"max\": 10000.0,\n        \"num_unique_values\": 8,\n        \"samples\": [\n          1538.7761,\n          1503.0,\n          10000.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Torque [Nm]\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 3522.9553380464763,\n        \"min\": 3.8,\n        \"max\": 10000.0,\n        \"num_unique_values\": 8,\n        \"samples\": [\n          39.986909999999995,\n          40.1,\n          10000.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Tool wear [min]\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 3498.6028684989537,\n        \"min\": 0.0,\n        \"max\": 10000.0,\n        \"num_unique_values\": 8,\n        \"samples\": [\n          107.951,\n          108.0,\n          10000.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}"
+            }
+          },
+          "metadata": {},
+          "execution_count": 6
+        }
+      ],
+      "source": [
+        "data_df[numeric_features].describe()"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "888a838c-f16c-408c-bcd6-5aa0f13d943c",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "phM5W-m2HWHE",
+        "outputId": "db3783cb-e734-4880-b3bc-0b49ed69bb20",
+        "colab": {
+          "base_uri": "https://localhost:8080/",
+          "height": 175
+        }
+      },
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "         Type\n",
+              "count   10000\n",
+              "unique      3\n",
+              "top         L\n",
+              "freq     6000"
+            ],
+            "text/html": [
+              "\n",
+              "  <div id=\"df-a6edd195-efd0-4084-be95-e28067f35130\" class=\"colab-df-container\">\n",
+              "    <div>\n",
+              "<style scoped>\n",
+              "    .dataframe tbody tr th:only-of-type {\n",
+              "        vertical-align: middle;\n",
+              "    }\n",
+              "\n",
+              "    .dataframe tbody tr th {\n",
+              "        vertical-align: top;\n",
+              "    }\n",
+              "\n",
+              "    .dataframe thead th {\n",
+              "        text-align: right;\n",
+              "    }\n",
+              "</style>\n",
+              "<table border=\"1\" class=\"dataframe\">\n",
+              "  <thead>\n",
+              "    <tr style=\"text-align: right;\">\n",
+              "      <th></th>\n",
+              "      <th>Type</th>\n",
+              "    </tr>\n",
+              "  </thead>\n",
+              "  <tbody>\n",
+              "    <tr>\n",
+              "      <th>count</th>\n",
+              "      <td>10000</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>unique</th>\n",
+              "      <td>3</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>top</th>\n",
+              "      <td>L</td>\n",
+              "    </tr>\n",
+              "    <tr>\n",
+              "      <th>freq</th>\n",
+              "      <td>6000</td>\n",
+              "    </tr>\n",
+              "  </tbody>\n",
+              "</table>\n",
+              "</div>\n",
+              "    <div class=\"colab-df-buttons\">\n",
+              "\n",
+              "  <div class=\"colab-df-container\">\n",
+              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-a6edd195-efd0-4084-be95-e28067f35130')\"\n",
+              "            title=\"Convert this dataframe to an interactive table.\"\n",
+              "            style=\"display:none;\">\n",
+              "\n",
+              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
+              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
+              "  </svg>\n",
+              "    </button>\n",
+              "\n",
+              "  <style>\n",
+              "    .colab-df-container {\n",
+              "      display:flex;\n",
+              "      gap: 12px;\n",
+              "    }\n",
+              "\n",
+              "    .colab-df-convert {\n",
+              "      background-color: #E8F0FE;\n",
+              "      border: none;\n",
+              "      border-radius: 50%;\n",
+              "      cursor: pointer;\n",
+              "      display: none;\n",
+              "      fill: #1967D2;\n",
+              "      height: 32px;\n",
+              "      padding: 0 0 0 0;\n",
+              "      width: 32px;\n",
+              "    }\n",
+              "\n",
+              "    .colab-df-convert:hover {\n",
+              "      background-color: #E2EBFA;\n",
+              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
+              "      fill: #174EA6;\n",
+              "    }\n",
+              "\n",
+              "    .colab-df-buttons div {\n",
+              "      margin-bottom: 4px;\n",
+              "    }\n",
+              "\n",
+              "    [theme=dark] .colab-df-convert {\n",
+              "      background-color: #3B4455;\n",
+              "      fill: #D2E3FC;\n",
+              "    }\n",
+              "\n",
+              "    [theme=dark] .colab-df-convert:hover {\n",
+              "      background-color: #434B5C;\n",
+              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
+              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
+              "      fill: #FFFFFF;\n",
+              "    }\n",
+              "  </style>\n",
+              "\n",
+              "    <script>\n",
+              "      const buttonEl =\n",
+              "        document.querySelector('#df-a6edd195-efd0-4084-be95-e28067f35130 button.colab-df-convert');\n",
+              "      buttonEl.style.display =\n",
+              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
+              "\n",
+              "      async function convertToInteractive(key) {\n",
+              "        const element = document.querySelector('#df-a6edd195-efd0-4084-be95-e28067f35130');\n",
+              "        const dataTable =\n",
+              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
+              "                                                    [key], {});\n",
+              "        if (!dataTable) return;\n",
+              "\n",
+              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
+              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
+              "          + ' to learn more about interactive tables.';\n",
+              "        element.innerHTML = '';\n",
+              "        dataTable['output_type'] = 'display_data';\n",
+              "        await google.colab.output.renderOutput(dataTable, element);\n",
+              "        const docLink = document.createElement('div');\n",
+              "        docLink.innerHTML = docLinkHtml;\n",
+              "        element.appendChild(docLink);\n",
+              "      }\n",
+              "    </script>\n",
+              "  </div>\n",
+              "\n",
+              "\n",
+              "<div id=\"df-2863f3f0-cdb9-42e9-a2c2-f66317d3d531\">\n",
+              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-2863f3f0-cdb9-42e9-a2c2-f66317d3d531')\"\n",
+              "            title=\"Suggest charts\"\n",
+              "            style=\"display:none;\">\n",
+              "\n",
+              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
+              "     width=\"24px\">\n",
+              "    <g>\n",
+              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
+              "    </g>\n",
+              "</svg>\n",
+              "  </button>\n",
+              "\n",
+              "<style>\n",
+              "  .colab-df-quickchart {\n",
+              "      --bg-color: #E8F0FE;\n",
+              "      --fill-color: #1967D2;\n",
+              "      --hover-bg-color: #E2EBFA;\n",
+              "      --hover-fill-color: #174EA6;\n",
+              "      --disabled-fill-color: #AAA;\n",
+              "      --disabled-bg-color: #DDD;\n",
+              "  }\n",
+              "\n",
+              "  [theme=dark] .colab-df-quickchart {\n",
+              "      --bg-color: #3B4455;\n",
+              "      --fill-color: #D2E3FC;\n",
+              "      --hover-bg-color: #434B5C;\n",
+              "      --hover-fill-color: #FFFFFF;\n",
+              "      --disabled-bg-color: #3B4455;\n",
+              "      --disabled-fill-color: #666;\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-quickchart {\n",
+              "    background-color: var(--bg-color);\n",
+              "    border: none;\n",
+              "    border-radius: 50%;\n",
+              "    cursor: pointer;\n",
+              "    display: none;\n",
+              "    fill: var(--fill-color);\n",
+              "    height: 32px;\n",
+              "    padding: 0;\n",
+              "    width: 32px;\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-quickchart:hover {\n",
+              "    background-color: var(--hover-bg-color);\n",
+              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
+              "    fill: var(--button-hover-fill-color);\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-quickchart-complete:disabled,\n",
+              "  .colab-df-quickchart-complete:disabled:hover {\n",
+              "    background-color: var(--disabled-bg-color);\n",
+              "    fill: var(--disabled-fill-color);\n",
+              "    box-shadow: none;\n",
+              "  }\n",
+              "\n",
+              "  .colab-df-spinner {\n",
+              "    border: 2px solid var(--fill-color);\n",
+              "    border-color: transparent;\n",
+              "    border-bottom-color: var(--fill-color);\n",
+              "    animation:\n",
+              "      spin 1s steps(1) infinite;\n",
+              "  }\n",
+              "\n",
+              "  @keyframes spin {\n",
+              "    0% {\n",
+              "      border-color: transparent;\n",
+              "      border-bottom-color: var(--fill-color);\n",
+              "      border-left-color: var(--fill-color);\n",
+              "    }\n",
+              "    20% {\n",
+              "      border-color: transparent;\n",
+              "      border-left-color: var(--fill-color);\n",
+              "      border-top-color: var(--fill-color);\n",
+              "    }\n",
+              "    30% {\n",
+              "      border-color: transparent;\n",
+              "      border-left-color: var(--fill-color);\n",
+              "      border-top-color: var(--fill-color);\n",
+              "      border-right-color: var(--fill-color);\n",
+              "    }\n",
+              "    40% {\n",
+              "      border-color: transparent;\n",
+              "      border-right-color: var(--fill-color);\n",
+              "      border-top-color: var(--fill-color);\n",
+              "    }\n",
+              "    60% {\n",
+              "      border-color: transparent;\n",
+              "      border-right-color: var(--fill-color);\n",
+              "    }\n",
+              "    80% {\n",
+              "      border-color: transparent;\n",
+              "      border-right-color: var(--fill-color);\n",
+              "      border-bottom-color: var(--fill-color);\n",
+              "    }\n",
+              "    90% {\n",
+              "      border-color: transparent;\n",
+              "      border-bottom-color: var(--fill-color);\n",
+              "    }\n",
+              "  }\n",
+              "</style>\n",
+              "\n",
+              "  <script>\n",
+              "    async function quickchart(key) {\n",
+              "      const quickchartButtonEl =\n",
+              "        document.querySelector('#' + key + ' button');\n",
+              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
+              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
+              "      try {\n",
+              "        const charts = await google.colab.kernel.invokeFunction(\n",
+              "            'suggestCharts', [key], {});\n",
+              "      } catch (error) {\n",
+              "        console.error('Error during call to suggestCharts:', error);\n",
+              "      }\n",
+              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
+              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
+              "    }\n",
+              "    (() => {\n",
+              "      let quickchartButtonEl =\n",
+              "        document.querySelector('#df-2863f3f0-cdb9-42e9-a2c2-f66317d3d531 button');\n",
+              "      quickchartButtonEl.style.display =\n",
+              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
+              "    })();\n",
+              "  </script>\n",
+              "</div>\n",
+              "\n",
+              "    </div>\n",
+              "  </div>\n"
+            ],
+            "application/vnd.google.colaboratory.intrinsic+json": {
+              "type": "dataframe",
+              "summary": "{\n  \"name\": \"data_df[categorical_features]\",\n  \"rows\": 4,\n  \"fields\": [\n    {\n      \"column\": \"Type\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 4,\n        \"samples\": [\n          3,\n          \"6000\",\n          \"10000\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}"
+            }
+          },
+          "metadata": {},
+          "execution_count": 7
+        }
+      ],
+      "source": [
+        "data_df[categorical_features].describe()"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "data_df[target].value_counts()"
+      ],
+      "metadata": {
+        "id": "dVRml2osH8Av",
+        "outputId": "e5b7ecf2-d241-4ed1-f66b-db953dff1f1d",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "0    9661\n",
+              "1     339\n",
+              "Name: Machine failure, dtype: int64"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 8
+        }
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "550dfffd-2a1f-44c5-8d31-23a452896bef",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "Cl7T7_jFHWHE"
+      },
+      "source": [
+        "# Model Estimation"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "0c99d9b0-4771-487b-86fd-9d452118b7ab",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "YKuRNqVuHWHE"
+      },
+      "outputs": [],
+      "source": [
+        "X = data_df[numeric_features + categorical_features]\n",
+        "y = data_df[target]"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "1e90b308-b374-4f65-81b8-598a0bab1d1d",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "tbgt_5ZCHWHF"
+      },
+      "outputs": [],
+      "source": [
+        "Xtrain, Xtest, ytrain, ytest = train_test_split(\n",
+        "    X, y,\n",
+        "    test_size=0.2,\n",
+        "    random_state=42\n",
+        ")"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "bffcbcac-0047-4332-b206-9fadb5c78956",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "GYnMo95hHWHF"
+      },
+      "outputs": [],
+      "source": [
+        "preprocessor = make_column_transformer(\n",
+        "    (StandardScaler(), numeric_features),\n",
+        "    (OneHotEncoder(handle_unknown='ignore'), categorical_features)\n",
+        ")"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "76a64681-e124-4eef-ada8-75a8511dc783",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "D83BGGp3HWHF"
+      },
+      "outputs": [],
+      "source": [
+        "model_logistic_regression = LogisticRegression(n_jobs=-1)"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "7e566699-0812-46e2-a48b-cf8a4f83c7b6",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "3HkzYXsPHWHF"
+      },
+      "outputs": [],
+      "source": [
+        "model_pipeline = make_pipeline(\n",
+        "    preprocessor,\n",
+        "    model_logistic_regression\n",
+        ")"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "245034db-84c4-406f-b808-dde8860b9084",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "E_ZmCrDnHWHG",
+        "outputId": "39bd9532-0181-4509-d069-6b158c3e7875",
+        "colab": {
+          "base_uri": "https://localhost:8080/",
+          "height": 192
+        }
+      },
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "Pipeline(steps=[('columntransformer',\n",
+              "                 ColumnTransformer(transformers=[('standardscaler',\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  ['Air temperature [K]',\n",
+              "                                                   'Process temperature [K]',\n",
+              "                                                   'Rotational speed [rpm]',\n",
+              "                                                   'Torque [Nm]',\n",
+              "                                                   'Tool wear [min]']),\n",
+              "                                                 ('onehotencoder',\n",
+              "                                                  OneHotEncoder(handle_unknown='ignore'),\n",
+              "                                                  ['Type'])])),\n",
+              "                ('logisticregression', LogisticRegression(n_jobs=-1))])"
+            ],
+            "text/html": [
+              "<style>#sk-container-id-1 {color: black;background-color: white;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(n_jobs=-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 sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" ><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">Pipeline</label><div class=\"sk-toggleable__content\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(n_jobs=-1))])</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" ><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">columntransformer: ColumnTransformer</label><div class=\"sk-toggleable__content\"><pre>ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;, StandardScaler(),\n",
+              "                                 [&#x27;Air temperature [K]&#x27;,\n",
+              "                                  &#x27;Process temperature [K]&#x27;,\n",
+              "                                  &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;,\n",
+              "                                  &#x27;Tool wear [min]&#x27;]),\n",
+              "                                (&#x27;onehotencoder&#x27;,\n",
+              "                                 OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                 [&#x27;Type&#x27;])])</pre></div></div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-3\" type=\"checkbox\" ><label for=\"sk-estimator-id-3\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">standardscaler</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Air temperature [K]&#x27;, &#x27;Process temperature [K]&#x27;, &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;, &#x27;Tool wear [min]&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-4\" type=\"checkbox\" ><label for=\"sk-estimator-id-4\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">StandardScaler</label><div class=\"sk-toggleable__content\"><pre>StandardScaler()</pre></div></div></div></div></div></div><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-5\" type=\"checkbox\" ><label for=\"sk-estimator-id-5\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">onehotencoder</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Type&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-6\" type=\"checkbox\" ><label for=\"sk-estimator-id-6\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">OneHotEncoder</label><div class=\"sk-toggleable__content\"><pre>OneHotEncoder(handle_unknown=&#x27;ignore&#x27;)</pre></div></div></div></div></div></div></div></div><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-7\" type=\"checkbox\" ><label for=\"sk-estimator-id-7\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LogisticRegression</label><div class=\"sk-toggleable__content\"><pre>LogisticRegression(n_jobs=-1)</pre></div></div></div></div></div></div></div>"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 14
+        }
+      ],
+      "source": [
+        "model_pipeline.fit(Xtrain, ytrain)"
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {},
+          "inputWidgets": {},
+          "nuid": "b69edec2-1b51-47d1-89a4-18ed7d7814f7",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "vKh6Gg6BHWHG"
+      },
+      "source": [
+        "# Model Evaluation"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "087eeb21-d77e-4ca1-9f75-414586c18b7d",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "yquQSa6KHWHH",
+        "outputId": "4bad9720-4659-42a3-c38f-a10a3f245f10",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "array([0, 0, 0, ..., 0, 0, 0])"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 15
+        }
+      ],
+      "source": [
+        "model_pipeline.predict(Xtest)"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "841dbbf4-00fe-43bb-86b7-13e184d3759d",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "KdXMlBmGHWHH",
+        "outputId": "e35a4a06-b334-4294-b54a-444e536872e4",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "0.9735"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 16
+        }
+      ],
+      "source": [
+        "accuracy_score(ytest, model_pipeline.predict(Xtest))"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "print(classification_report(ytest, model_pipeline.predict(Xtest)))"
+      ],
+      "metadata": {
+        "id": "ZTwKVOtmHr-M",
+        "outputId": "1b93e443-73ff-4d18-f651-0e34abd5c353",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "              precision    recall  f1-score   support\n",
+            "\n",
+            "           0       0.98      1.00      0.99      1939\n",
+            "           1       0.67      0.26      0.38        61\n",
+            "\n",
+            "    accuracy                           0.97      2000\n",
+            "   macro avg       0.82      0.63      0.68      2000\n",
+            "weighted avg       0.97      0.97      0.97      2000\n",
+            "\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "# Hyperparameter Tuning"
+      ],
+      "metadata": {
+        "id": "UGqiCLRnRx8i"
+      }
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "bffcbcac-0047-4332-b206-9fadb5c78956",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "D8BdWyOUR46x"
+      },
+      "outputs": [],
+      "source": [
+        "preprocessor = make_column_transformer(\n",
+        "    (StandardScaler(), numeric_features),\n",
+        "    (OneHotEncoder(handle_unknown='ignore'), categorical_features)\n",
+        ")"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "76a64681-e124-4eef-ada8-75a8511dc783",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "creqMx9fR46y"
+      },
+      "outputs": [],
+      "source": [
+        "model_logistic_regression = LogisticRegression(n_jobs=-1)"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "execution_count": null,
+      "metadata": {
+        "application/vnd.databricks.v1+cell": {
+          "cellMetadata": {
+            "byteLimit": 2048000,
+            "rowLimit": 10000
+          },
+          "inputWidgets": {},
+          "nuid": "7e566699-0812-46e2-a48b-cf8a4f83c7b6",
+          "showTitle": false,
+          "title": ""
+        },
+        "id": "bwV3VmWrR46y"
+      },
+      "outputs": [],
+      "source": [
+        "model_pipeline = make_pipeline(\n",
+        "    preprocessor,\n",
+        "    model_logistic_regression\n",
+        ")"
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "model_pipeline.named_steps"
+      ],
+      "metadata": {
+        "id": "fSNxALuGR6iT",
+        "outputId": "1c942461-8281-4e55-ec28-e6f34840a300",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "{'columntransformer': ColumnTransformer(transformers=[('standardscaler', StandardScaler(),\n",
+              "                                  ['Air temperature [K]',\n",
+              "                                   'Process temperature [K]',\n",
+              "                                   'Rotational speed [rpm]', 'Torque [Nm]',\n",
+              "                                   'Tool wear [min]']),\n",
+              "                                 ('onehotencoder',\n",
+              "                                  OneHotEncoder(handle_unknown='ignore'),\n",
+              "                                  ['Type'])]),\n",
+              " 'logisticregression': LogisticRegression(n_jobs=-1)}"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 21
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "param_distribution = {\n",
+        "    \"logisticregression__C\": [0.001, 0.01, 0.1, 0.5, 1, 5, 10]\n",
+        "}"
+      ],
+      "metadata": {
+        "id": "GlOJwOE2SA4m"
+      },
+      "execution_count": null,
+      "outputs": []
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "rand_search_cv = RandomizedSearchCV(\n",
+        "    model_pipeline,\n",
+        "    param_distribution,\n",
+        "    n_iter=3,\n",
+        "    cv=3,\n",
+        "    random_state=42\n",
+        ")"
+      ],
+      "metadata": {
+        "id": "e-6kTwZkSfxT"
+      },
+      "execution_count": null,
+      "outputs": []
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "rand_search_cv.fit(Xtrain, ytrain)"
+      ],
+      "metadata": {
+        "id": "ycqTA2xKSjU7",
+        "outputId": "67e1ecfc-f048-4251-a702-aa74fd70d065",
+        "colab": {
+          "base_uri": "https://localhost:8080/",
+          "height": 218
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "RandomizedSearchCV(cv=3,\n",
+              "                   estimator=Pipeline(steps=[('columntransformer',\n",
+              "                                              ColumnTransformer(transformers=[('standardscaler',\n",
+              "                                                                               StandardScaler(),\n",
+              "                                                                               ['Air '\n",
+              "                                                                                'temperature '\n",
+              "                                                                                '[K]',\n",
+              "                                                                                'Process '\n",
+              "                                                                                'temperature '\n",
+              "                                                                                '[K]',\n",
+              "                                                                                'Rotational '\n",
+              "                                                                                'speed '\n",
+              "                                                                                '[rpm]',\n",
+              "                                                                                'Torque '\n",
+              "                                                                                '[Nm]',\n",
+              "                                                                                'Tool '\n",
+              "                                                                                'wear '\n",
+              "                                                                                '[min]']),\n",
+              "                                                                              ('onehotencoder',\n",
+              "                                                                               OneHotEncoder(handle_unknown='ignore'),\n",
+              "                                                                               ['Type'])])),\n",
+              "                                             ('logisticregression',\n",
+              "                                              LogisticRegression(n_jobs=-1))]),\n",
+              "                   n_iter=3,\n",
+              "                   param_distributions={'logisticregression__C': [0.001, 0.01,\n",
+              "                                                                  0.1, 0.5, 1,\n",
+              "                                                                  5, 10]},\n",
+              "                   random_state=42)"
+            ],
+            "text/html": [
+              "<style>#sk-container-id-2 {color: black;background-color: white;}#sk-container-id-2 pre{padding: 0;}#sk-container-id-2 div.sk-toggleable {background-color: white;}#sk-container-id-2 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-2 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-2 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-2 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-2 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-2 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-2 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-2 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-2 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-2 div.sk-item {position: relative;z-index: 1;}#sk-container-id-2 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-2 div.sk-item::before, #sk-container-id-2 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-2 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-2 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-2 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-2 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-2 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-2 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-2 div.sk-label-container {text-align: center;}#sk-container-id-2 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-2 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>RandomizedSearchCV(cv=3,\n",
+              "                   estimator=Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                                              ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                                               StandardScaler(),\n",
+              "                                                                               [&#x27;Air &#x27;\n",
+              "                                                                                &#x27;temperature &#x27;\n",
+              "                                                                                &#x27;[K]&#x27;,\n",
+              "                                                                                &#x27;Process &#x27;\n",
+              "                                                                                &#x27;temperature &#x27;\n",
+              "                                                                                &#x27;[K]&#x27;,\n",
+              "                                                                                &#x27;Rotational &#x27;\n",
+              "                                                                                &#x27;speed &#x27;\n",
+              "                                                                                &#x27;[rpm]&#x27;,\n",
+              "                                                                                &#x27;Torque &#x27;\n",
+              "                                                                                &#x27;[Nm]&#x27;,\n",
+              "                                                                                &#x27;Tool &#x27;\n",
+              "                                                                                &#x27;wear &#x27;\n",
+              "                                                                                &#x27;[min]&#x27;]),\n",
+              "                                                                              (&#x27;onehotencoder&#x27;,\n",
+              "                                                                               OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                                               [&#x27;Type&#x27;])])),\n",
+              "                                             (&#x27;logisticregression&#x27;,\n",
+              "                                              LogisticRegression(n_jobs=-1))]),\n",
+              "                   n_iter=3,\n",
+              "                   param_distributions={&#x27;logisticregression__C&#x27;: [0.001, 0.01,\n",
+              "                                                                  0.1, 0.5, 1,\n",
+              "                                                                  5, 10]},\n",
+              "                   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 sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-8\" type=\"checkbox\" ><label for=\"sk-estimator-id-8\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">RandomizedSearchCV</label><div class=\"sk-toggleable__content\"><pre>RandomizedSearchCV(cv=3,\n",
+              "                   estimator=Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                                              ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                                               StandardScaler(),\n",
+              "                                                                               [&#x27;Air &#x27;\n",
+              "                                                                                &#x27;temperature &#x27;\n",
+              "                                                                                &#x27;[K]&#x27;,\n",
+              "                                                                                &#x27;Process &#x27;\n",
+              "                                                                                &#x27;temperature &#x27;\n",
+              "                                                                                &#x27;[K]&#x27;,\n",
+              "                                                                                &#x27;Rotational &#x27;\n",
+              "                                                                                &#x27;speed &#x27;\n",
+              "                                                                                &#x27;[rpm]&#x27;,\n",
+              "                                                                                &#x27;Torque &#x27;\n",
+              "                                                                                &#x27;[Nm]&#x27;,\n",
+              "                                                                                &#x27;Tool &#x27;\n",
+              "                                                                                &#x27;wear &#x27;\n",
+              "                                                                                &#x27;[min]&#x27;]),\n",
+              "                                                                              (&#x27;onehotencoder&#x27;,\n",
+              "                                                                               OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                                               [&#x27;Type&#x27;])])),\n",
+              "                                             (&#x27;logisticregression&#x27;,\n",
+              "                                              LogisticRegression(n_jobs=-1))]),\n",
+              "                   n_iter=3,\n",
+              "                   param_distributions={&#x27;logisticregression__C&#x27;: [0.001, 0.01,\n",
+              "                                                                  0.1, 0.5, 1,\n",
+              "                                                                  5, 10]},\n",
+              "                   random_state=42)</pre></div></div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-9\" type=\"checkbox\" ><label for=\"sk-estimator-id-9\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">estimator: Pipeline</label><div class=\"sk-toggleable__content\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(n_jobs=-1))])</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-serial\"><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-10\" type=\"checkbox\" ><label for=\"sk-estimator-id-10\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">columntransformer: ColumnTransformer</label><div class=\"sk-toggleable__content\"><pre>ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;, StandardScaler(),\n",
+              "                                 [&#x27;Air temperature [K]&#x27;,\n",
+              "                                  &#x27;Process temperature [K]&#x27;,\n",
+              "                                  &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;,\n",
+              "                                  &#x27;Tool wear [min]&#x27;]),\n",
+              "                                (&#x27;onehotencoder&#x27;,\n",
+              "                                 OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                 [&#x27;Type&#x27;])])</pre></div></div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-11\" type=\"checkbox\" ><label for=\"sk-estimator-id-11\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">standardscaler</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Air temperature [K]&#x27;, &#x27;Process temperature [K]&#x27;, &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;, &#x27;Tool wear [min]&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-12\" type=\"checkbox\" ><label for=\"sk-estimator-id-12\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">StandardScaler</label><div class=\"sk-toggleable__content\"><pre>StandardScaler()</pre></div></div></div></div></div></div><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-13\" type=\"checkbox\" ><label for=\"sk-estimator-id-13\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">onehotencoder</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Type&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-14\" type=\"checkbox\" ><label for=\"sk-estimator-id-14\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">OneHotEncoder</label><div class=\"sk-toggleable__content\"><pre>OneHotEncoder(handle_unknown=&#x27;ignore&#x27;)</pre></div></div></div></div></div></div></div></div><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-15\" type=\"checkbox\" ><label for=\"sk-estimator-id-15\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LogisticRegression</label><div class=\"sk-toggleable__content\"><pre>LogisticRegression(n_jobs=-1)</pre></div></div></div></div></div></div></div></div></div></div></div></div>"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 24
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "rand_search_cv.best_estimator_"
+      ],
+      "metadata": {
+        "id": "J4E01MTHSxkN",
+        "outputId": "bab81e57-2c37-4cca-cf56-14f53a8369f6",
+        "colab": {
+          "base_uri": "https://localhost:8080/",
+          "height": 192
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "Pipeline(steps=[('columntransformer',\n",
+              "                 ColumnTransformer(transformers=[('standardscaler',\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  ['Air temperature [K]',\n",
+              "                                                   'Process temperature [K]',\n",
+              "                                                   'Rotational speed [rpm]',\n",
+              "                                                   'Torque [Nm]',\n",
+              "                                                   'Tool wear [min]']),\n",
+              "                                                 ('onehotencoder',\n",
+              "                                                  OneHotEncoder(handle_unknown='ignore'),\n",
+              "                                                  ['Type'])])),\n",
+              "                ('logisticregression', LogisticRegression(C=5, n_jobs=-1))])"
+            ],
+            "text/html": [
+              "<style>#sk-container-id-3 {color: black;background-color: white;}#sk-container-id-3 pre{padding: 0;}#sk-container-id-3 div.sk-toggleable {background-color: white;}#sk-container-id-3 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-3 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-3 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-3 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-3 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-3 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-3 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-3 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-3 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-3 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-3 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-3 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-3 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-3 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-3 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-3 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-3 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-3 div.sk-item {position: relative;z-index: 1;}#sk-container-id-3 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-3 div.sk-item::before, #sk-container-id-3 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-3 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-3 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-3 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-3 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-3 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-3 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-3 div.sk-label-container {text-align: center;}#sk-container-id-3 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-3 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-3\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(C=5, n_jobs=-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 sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-16\" type=\"checkbox\" ><label for=\"sk-estimator-id-16\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">Pipeline</label><div class=\"sk-toggleable__content\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(C=5, n_jobs=-1))])</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-17\" type=\"checkbox\" ><label for=\"sk-estimator-id-17\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">columntransformer: ColumnTransformer</label><div class=\"sk-toggleable__content\"><pre>ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;, StandardScaler(),\n",
+              "                                 [&#x27;Air temperature [K]&#x27;,\n",
+              "                                  &#x27;Process temperature [K]&#x27;,\n",
+              "                                  &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;,\n",
+              "                                  &#x27;Tool wear [min]&#x27;]),\n",
+              "                                (&#x27;onehotencoder&#x27;,\n",
+              "                                 OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                 [&#x27;Type&#x27;])])</pre></div></div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-18\" type=\"checkbox\" ><label for=\"sk-estimator-id-18\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">standardscaler</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Air temperature [K]&#x27;, &#x27;Process temperature [K]&#x27;, &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;, &#x27;Tool wear [min]&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-19\" type=\"checkbox\" ><label for=\"sk-estimator-id-19\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">StandardScaler</label><div class=\"sk-toggleable__content\"><pre>StandardScaler()</pre></div></div></div></div></div></div><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-20\" type=\"checkbox\" ><label for=\"sk-estimator-id-20\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">onehotencoder</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Type&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-21\" type=\"checkbox\" ><label for=\"sk-estimator-id-21\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">OneHotEncoder</label><div class=\"sk-toggleable__content\"><pre>OneHotEncoder(handle_unknown=&#x27;ignore&#x27;)</pre></div></div></div></div></div></div></div></div><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-22\" type=\"checkbox\" ><label for=\"sk-estimator-id-22\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LogisticRegression</label><div class=\"sk-toggleable__content\"><pre>LogisticRegression(C=5, n_jobs=-1)</pre></div></div></div></div></div></div></div>"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 25
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "rand_search_cv.best_score_"
+      ],
+      "metadata": {
+        "id": "PL_j1mxxS8hm",
+        "outputId": "80c312d3-965b-479e-f66f-69ec03a49183",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "0.9691250146619894"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 26
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "print(classification_report(ytest, rand_search_cv.best_estimator_.predict(Xtest)))"
+      ],
+      "metadata": {
+        "id": "n06s0FlJUKmN",
+        "outputId": "a797f84d-ea72-46b9-b83e-cb9f5deef346",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        }
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "              precision    recall  f1-score   support\n",
+            "\n",
+            "           0       0.98      0.99      0.99      1939\n",
+            "           1       0.63      0.28      0.39        61\n",
+            "\n",
+            "    accuracy                           0.97      2000\n",
+            "   macro avg       0.80      0.64      0.69      2000\n",
+            "weighted avg       0.97      0.97      0.97      2000\n",
+            "\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "# Serialization"
+      ],
+      "metadata": {
+        "id": "lqkUvTHzO3UH"
+      }
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "!pip show scikit-learn"
+      ],
+      "metadata": {
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        },
+        "id": "q1VtbaO3O1E4",
+        "outputId": "58a62101-9aff-4a99-a022-90791aa1ea3c"
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "Name: scikit-learn\n",
+            "Version: 1.2.2\n",
+            "Summary: A set of python modules for machine learning and data mining\n",
+            "Home-page: http://scikit-learn.org\n",
+            "Author: \n",
+            "Author-email: \n",
+            "License: new BSD\n",
+            "Location: /usr/local/lib/python3.10/dist-packages\n",
+            "Requires: joblib, numpy, scipy, threadpoolctl\n",
+            "Required-by: bigframes, fastai, imbalanced-learn, librosa, mlxtend, qudida, sklearn-pandas, yellowbrick\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "%%writefile requirements.txt\n",
+        "scikit-learn==1.2.2"
+      ],
+      "metadata": {
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        },
+        "id": "2O3H_GLiO6KG",
+        "outputId": "226b92eb-6773-4343-ad0c-d824d9b7da8d"
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "Writing requirements.txt\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "%%writefile train.py\n",
+        "\n",
+        "import joblib\n",
+        "\n",
+        "from sklearn.datasets import fetch_openml\n",
+        "\n",
+        "from sklearn.preprocessing import StandardScaler, OneHotEncoder\n",
+        "from sklearn.compose import make_column_transformer\n",
+        "\n",
+        "from sklearn.pipeline import make_pipeline\n",
+        "\n",
+        "from sklearn.model_selection import train_test_split, RandomizedSearchCV\n",
+        "\n",
+        "from sklearn.linear_model import LogisticRegression\n",
+        "from sklearn.metrics import accuracy_score, classification_report\n",
+        "\n",
+        "dataset = fetch_openml(data_id=42890, as_frame=True, parser=\"auto\")\n",
+        "\n",
+        "data_df = dataset.data\n",
+        "\n",
+        "target = 'Machine failure'\n",
+        "numeric_features = [\n",
+        "    'Air temperature [K]',\n",
+        "    'Process temperature [K]',\n",
+        "    'Rotational speed [rpm]',\n",
+        "    'Torque [Nm]',\n",
+        "    'Tool wear [min]'\n",
+        "]\n",
+        "categorical_features = ['Type']\n",
+        "\n",
+        "print(\"Creating data subsets\")\n",
+        "\n",
+        "X = data_df[numeric_features + categorical_features]\n",
+        "y = data_df[target]\n",
+        "\n",
+        "Xtrain, Xtest, ytrain, ytest = train_test_split(\n",
+        "    X, y,\n",
+        "    test_size=0.2,\n",
+        "    random_state=42\n",
+        ")\n",
+        "\n",
+        "preprocessor = make_column_transformer(\n",
+        "    (StandardScaler(), numeric_features),\n",
+        "    (OneHotEncoder(handle_unknown='ignore'), categorical_features)\n",
+        ")\n",
+        "\n",
+        "model_logistic_regression = LogisticRegression(n_jobs=-1)\n",
+        "\n",
+        "print(\"Estimating Best Model Pipeline\")\n",
+        "\n",
+        "model_pipeline = make_pipeline(\n",
+        "    preprocessor,\n",
+        "    model_logistic_regression\n",
+        ")\n",
+        "\n",
+        "param_distribution = {\n",
+        "    \"logisticregression__C\": [0.001, 0.01, 0.1, 0.5, 1, 5, 10]\n",
+        "}\n",
+        "\n",
+        "rand_search_cv = RandomizedSearchCV(\n",
+        "    model_pipeline,\n",
+        "    param_distribution,\n",
+        "    n_iter=3,\n",
+        "    cv=3,\n",
+        "    random_state=42\n",
+        ")\n",
+        "\n",
+        "rand_search_cv.fit(Xtrain, ytrain)\n",
+        "\n",
+        "print(\"Logging Metrics\")\n",
+        "print(f\"Accuracy: {rand_search_cv.best_score_}\")\n",
+        "\n",
+        "print(\"Serializing Model\")\n",
+        "\n",
+        "saved_model_path = \"model.joblib\"\n",
+        "\n",
+        "joblib.dump(rand_search_cv.best_estimator_, saved_model_path)"
+      ],
+      "metadata": {
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        },
+        "id": "gAMAcWTYO8_s",
+        "outputId": "fa0903c7-c770-4d2b-c75f-b408f561ca5f"
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "Writing train.py\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "!python train.py"
+      ],
+      "metadata": {
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        },
+        "id": "T-JTqunHPckf",
+        "outputId": "1aff9f9a-cb25-47cc-8da7-59edde4afc95"
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "Creating data subsets\n",
+            "Estimating Best Model Pipeline\n",
+            "Logging Metrics\n",
+            "Accuracy: 0.9691250146619894\n",
+            "Serializing Model\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "# Test Predictions"
+      ],
+      "metadata": {
+        "id": "lFC4HfHjMR2G"
+      }
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "saved_model = joblib.load(\"model.joblib\")"
+      ],
+      "metadata": {
+        "id": "uNR7Dxj2MTM9"
+      },
+      "execution_count": null,
+      "outputs": []
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "saved_model"
+      ],
+      "metadata": {
+        "colab": {
+          "base_uri": "https://localhost:8080/",
+          "height": 192
+        },
+        "id": "LoPE6PZUM7Uh",
+        "outputId": "a05d48a1-2a8b-460b-cacc-38efc4c6928e"
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "Pipeline(steps=[('columntransformer',\n",
+              "                 ColumnTransformer(transformers=[('standardscaler',\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  ['Air temperature [K]',\n",
+              "                                                   'Process temperature [K]',\n",
+              "                                                   'Rotational speed [rpm]',\n",
+              "                                                   'Torque [Nm]',\n",
+              "                                                   'Tool wear [min]']),\n",
+              "                                                 ('onehotencoder',\n",
+              "                                                  OneHotEncoder(handle_unknown='ignore'),\n",
+              "                                                  ['Type'])])),\n",
+              "                ('logisticregression', LogisticRegression(C=5, n_jobs=-1))])"
+            ],
+            "text/html": [
+              "<style>#sk-container-id-4 {color: black;background-color: white;}#sk-container-id-4 pre{padding: 0;}#sk-container-id-4 div.sk-toggleable {background-color: white;}#sk-container-id-4 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-4 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-4 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-4 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-4 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-4 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-4 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-4 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-4 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-4 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-4 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-4 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-4 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-4 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-4 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-4 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-4 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-4 div.sk-item {position: relative;z-index: 1;}#sk-container-id-4 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-4 div.sk-item::before, #sk-container-id-4 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-4 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-4 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-4 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-4 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-4 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-4 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-4 div.sk-label-container {text-align: center;}#sk-container-id-4 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-4 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-4\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(C=5, n_jobs=-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 sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-23\" type=\"checkbox\" ><label for=\"sk-estimator-id-23\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">Pipeline</label><div class=\"sk-toggleable__content\"><pre>Pipeline(steps=[(&#x27;columntransformer&#x27;,\n",
+              "                 ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;,\n",
+              "                                                  StandardScaler(),\n",
+              "                                                  [&#x27;Air temperature [K]&#x27;,\n",
+              "                                                   &#x27;Process temperature [K]&#x27;,\n",
+              "                                                   &#x27;Rotational speed [rpm]&#x27;,\n",
+              "                                                   &#x27;Torque [Nm]&#x27;,\n",
+              "                                                   &#x27;Tool wear [min]&#x27;]),\n",
+              "                                                 (&#x27;onehotencoder&#x27;,\n",
+              "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                                  [&#x27;Type&#x27;])])),\n",
+              "                (&#x27;logisticregression&#x27;, LogisticRegression(C=5, n_jobs=-1))])</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-24\" type=\"checkbox\" ><label for=\"sk-estimator-id-24\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">columntransformer: ColumnTransformer</label><div class=\"sk-toggleable__content\"><pre>ColumnTransformer(transformers=[(&#x27;standardscaler&#x27;, StandardScaler(),\n",
+              "                                 [&#x27;Air temperature [K]&#x27;,\n",
+              "                                  &#x27;Process temperature [K]&#x27;,\n",
+              "                                  &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;,\n",
+              "                                  &#x27;Tool wear [min]&#x27;]),\n",
+              "                                (&#x27;onehotencoder&#x27;,\n",
+              "                                 OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
+              "                                 [&#x27;Type&#x27;])])</pre></div></div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-25\" type=\"checkbox\" ><label for=\"sk-estimator-id-25\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">standardscaler</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Air temperature [K]&#x27;, &#x27;Process temperature [K]&#x27;, &#x27;Rotational speed [rpm]&#x27;, &#x27;Torque [Nm]&#x27;, &#x27;Tool wear [min]&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-26\" type=\"checkbox\" ><label for=\"sk-estimator-id-26\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">StandardScaler</label><div class=\"sk-toggleable__content\"><pre>StandardScaler()</pre></div></div></div></div></div></div><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-27\" type=\"checkbox\" ><label for=\"sk-estimator-id-27\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">onehotencoder</label><div class=\"sk-toggleable__content\"><pre>[&#x27;Type&#x27;]</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-28\" type=\"checkbox\" ><label for=\"sk-estimator-id-28\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">OneHotEncoder</label><div class=\"sk-toggleable__content\"><pre>OneHotEncoder(handle_unknown=&#x27;ignore&#x27;)</pre></div></div></div></div></div></div></div></div><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-29\" type=\"checkbox\" ><label for=\"sk-estimator-id-29\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LogisticRegression</label><div class=\"sk-toggleable__content\"><pre>LogisticRegression(C=5, n_jobs=-1)</pre></div></div></div></div></div></div></div>"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 33
+        }
+      ]
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "saved_model.predict(Xtest)"
+      ],
+      "metadata": {
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        },
+        "id": "MzpxBjtSM9f-",
+        "outputId": "7795684b-11fa-4a5a-d1ca-5c4774742277"
+      },
+      "execution_count": null,
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "array([0, 0, 0, ..., 0, 0, 0])"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 34
+        }
+      ]
+    }
+  ],
+  "metadata": {
+    "application/vnd.databricks.v1+notebook": {
+      "dashboards": [],
+      "language": "python",
+      "notebookMetadata": {
+        "pythonIndentUnit": 4
+      },
+      "notebookName": "machine_failure_prediction",
+      "widgets": {}
+    },
+    "colab": {
+      "provenance": []
+    },
+    "language_info": {
+      "name": "python"
+    },
+    "kernelspec": {
+      "name": "python3",
+      "display_name": "Python 3"
+    }
+  },
+  "nbformat": 4,
+  "nbformat_minor": 0
+}
\ No newline at end of file