{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "i3nScBkEfDn5" }, "source": [ "# Install and Load Packages" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "r7rp9-CtfGio", "outputId": "281a358e-6327-405e-9e7e-22e369134684" }, "outputs": [], "source": [ "# !pip install flaml" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "hX-mivp1hQC2", "outputId": "87c45e07-f96d-404e-d8f7-75790038bf07" }, "outputs": [], "source": [ "# !pip install lime" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "id": "mitElpzkL3ss" }, "outputs": [], "source": [ "import lime\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "# import seaborn as sns\n", "\n", "import plotly.express as px\n", "import plotly.graph_objects as go\n", "from flaml import AutoML" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "id": "YzRYyylBMR4B" }, "outputs": [], "source": [ "raw_data = pd.read_csv(\"https://raw.githubusercontent.com/hadimaster65555/dataset_for_teaching/main/dataset/hr_analytics_turnover_dataset/HR_comma_sep.csv\")" ] }, { "cell_type": "markdown", "metadata": { "id": "s8rkIZWPN-4N" }, "source": [ "# Data Inspection" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 226 }, "id": "x6flf6A5NQJj", "outputId": "c1458c04-35b1-411c-ae69-a72222b33101" }, "outputs": [ { "data": { "text/html": [ "
\n", " | satisfaction_level | \n", "last_evaluation | \n", "number_project | \n", "average_montly_hours | \n", "time_spend_company | \n", "Work_accident | \n", "left | \n", "promotion_last_5years | \n", "sales | \n", "salary | \n", "
---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0.38 | \n", "0.53 | \n", "2 | \n", "157 | \n", "3 | \n", "0 | \n", "1 | \n", "0 | \n", "sales | \n", "low | \n", "
1 | \n", "0.80 | \n", "0.86 | \n", "5 | \n", "262 | \n", "6 | \n", "0 | \n", "1 | \n", "0 | \n", "sales | \n", "medium | \n", "
2 | \n", "0.11 | \n", "0.88 | \n", "7 | \n", "272 | \n", "4 | \n", "0 | \n", "1 | \n", "0 | \n", "sales | \n", "medium | \n", "
3 | \n", "0.72 | \n", "0.87 | \n", "5 | \n", "223 | \n", "5 | \n", "0 | \n", "1 | \n", "0 | \n", "sales | \n", "low | \n", "
4 | \n", "0.37 | \n", "0.52 | \n", "2 | \n", "159 | \n", "3 | \n", "0 | \n", "1 | \n", "0 | \n", "sales | \n", "low | \n", "
XGBClassifier(base_score=None, booster=None, callbacks=[],\n", " colsample_bylevel=0.5210664820067598, colsample_bynode=None,\n", " colsample_bytree=0.8326041578837515, device=None,\n", " early_stopping_rounds=None, enable_categorical=False,\n", " eval_metric=None, feature_types=None, gamma=None,\n", " grow_policy='lossguide', importance_type=None,\n", " interaction_constraints=None, learning_rate=0.6064978559327864,\n", " max_bin=None, max_cat_threshold=None, max_cat_to_onehot=None,\n", " max_delta_step=None, max_depth=0, max_leaves=211,\n", " min_child_weight=0.0888416394086547, missing=nan,\n", " monotone_constraints=None, multi_strategy=None, n_estimators=18,\n", " n_jobs=-1, num_parallel_tree=None, random_state=None, ...)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
XGBClassifier(base_score=None, booster=None, callbacks=[],\n", " colsample_bylevel=0.5210664820067598, colsample_bynode=None,\n", " colsample_bytree=0.8326041578837515, device=None,\n", " early_stopping_rounds=None, enable_categorical=False,\n", " eval_metric=None, feature_types=None, gamma=None,\n", " grow_policy='lossguide', importance_type=None,\n", " interaction_constraints=None, learning_rate=0.6064978559327864,\n", " max_bin=None, max_cat_threshold=None, max_cat_to_onehot=None,\n", " max_delta_step=None, max_depth=0, max_leaves=211,\n", " min_child_weight=0.0888416394086547, missing=nan,\n", " monotone_constraints=None, multi_strategy=None, n_estimators=18,\n", " n_jobs=-1, num_parallel_tree=None, random_state=None, ...)
\n", " | variable | \n", "value | \n", "
---|---|---|
0 | \n", "satisfaction_level | \n", "-0.043170 | \n", "
1 | \n", "average_montly_hours | \n", "0.027885 | \n", "
2 | \n", "time_spend_company | \n", "0.014083 | \n", "
3 | \n", "last_evaluation | \n", "0.008947 | \n", "
4 | \n", "number_project | \n", "-0.004481 | \n", "
5 | \n", "roles_RandD | \n", "-0.004312 | \n", "
6 | \n", "roles_hr | \n", "-0.004029 | \n", "
7 | \n", "roles_sales | \n", "0.002918 | \n", "
8 | \n", "roles_management | \n", "0.001900 | \n", "
9 | \n", "salary | \n", "-0.001476 | \n", "
10 | \n", "Work_accident | \n", "0.001409 | \n", "
11 | \n", "roles_accounting | \n", "-0.001405 | \n", "
12 | \n", "roles_marketing | \n", "-0.001164 | \n", "
13 | \n", "roles_support | \n", "0.001077 | \n", "
14 | \n", "promotion_last_5years | \n", "-0.000965 | \n", "
15 | \n", "roles_product_mng | \n", "-0.000964 | \n", "
16 | \n", "roles_technical | \n", "-0.000688 | \n", "