design layout fix

This commit is contained in:
Jesselyn Mu
2025-02-01 12:36:28 +07:00
parent 49f1f93bd9
commit 84f08f24c6
9 changed files with 15417 additions and 8535 deletions

33
App.py
View File

@ -10,17 +10,13 @@ from pages.exploration import show_exploration
from pages.karyawan_komen import show_karyawan_komen
from pages.pimpinan_exploration import show_pimpinan_exploration
# Set konfigurasi halaman sebagai perintah pertama
st.set_page_config(page_title="Aplikasi Prediksi Retensi Karyawan", layout="wide", initial_sidebar_state="collapsed")
st.set_page_config(page_title="TALENTRA", layout="wide", initial_sidebar_state="collapsed")
# Tambahkan direktori 'App' ke sys.path
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
# Import halaman dari folder pages
import pages as pg
# Import halaman dari root directory
from login import show_login # Impor dari file login.py di root directory
from login import show_login
parent_dir = os.path.dirname(os.path.abspath(__file__))
logo_path = os.path.join(parent_dir, "asset/logo.png")
@ -51,7 +47,6 @@ st.markdown(
unsafe_allow_html=True,
)
# CSS untuk mengubah warna latar belakang
background_style = """
<style>
.stApp {
@ -84,7 +79,6 @@ if "page" not in st.session_state:
else:
st.session_state.page = "Home"
# Tambahkan validasi login
if 'logged_in' in st.session_state and st.session_state['logged_in']:
role = st.session_state.get('role', '').lower()
role_pages = {
@ -112,8 +106,7 @@ def get_image_as_base64(image_path):
return base64.b64encode(img_file.read()).decode("utf-8")
def navbar_with_sidebar_control(pages, options, logo_path):
# Kontrol sidebar visibility
if not options.get("show_sidebar", True): # Jika "show_sidebar" = False
if not options.get("show_sidebar", True):
st.markdown(
"""
<style>
@ -125,7 +118,6 @@ def navbar_with_sidebar_control(pages, options, logo_path):
unsafe_allow_html=True,
)
# Render navbar
navbar_home()
def navbar_home():
@ -188,7 +180,7 @@ def navbar_home():
</div>
<div class="nav-links">
<!-- Ganti teks "Home" dengan teks statis -->
<span class="welcome-text">Selamat Datang di Aplikasi Prediksi Retensi Karyawan</span>
<span class="welcome-text">Selamat Datang di TALENTRA</span>
</div>
<a class="login-button" href="?page=Login">Login</a>
</div>
@ -196,13 +188,11 @@ def navbar_home():
unsafe_allow_html=True,
)
# Atur Navbar dengan kontrol sidebar
options = {
"show_menu": False,
"show_sidebar": False, # Ubah ke True jika ingin menampilkan sidebar
"show_sidebar": False,
}
# Atur Navbar dengan kontrol sidebar hanya untuk Home
if st.session_state.page == "Home":
navbar_with_sidebar_control(
pages=["Home", "Login"],
@ -210,24 +200,21 @@ if st.session_state.page == "Home":
logo_path=logo_path,
)
# Deklarasi fungsi halaman
functions = {
"Home": pg.show_home,
"Login": show_login, # Panggil fungsi show_login dari root directory
"admin": show_prediction, # Pastikan fungsi ini diimpor dan didefinisikan
"karyawan_form": show_karyawan_form, # Pastikan fungsi ini diimpor dan didefinisikan
"Login": show_login,
"admin": show_prediction,
"karyawan_form": show_karyawan_form,
"pimpinan_form": show_pimpinan_form,
"exploration": show_exploration,
"Prediksi": show_prediction, # Tambahkan ini
"report": show_report, # Tambahkan ini
"Prediksi": show_prediction,
"report": show_report,
"karyawan_komen": show_karyawan_komen,
"pimpinan_exploration": show_pimpinan_exploration
}
query_params = st.query_params
# Validasi query parameter
if "page" not in st.session_state:
query_params = st.query_params
print("Query parameters (raw):", repr(query_params))

14182
X_train.csv

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -135,7 +135,7 @@ def show_login():
color: white;
font-family: 'Poppins', sans-serif;
font-size: 16px;
font-weight: 600;
font-weight: 1000;
border: none;
border-radius: 5px;
padding: 10px;

File diff suppressed because it is too large Load Diff

View File

@ -6,194 +6,29 @@
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<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>employee_id</th>\n",
" <th>domisili</th>\n",
" <th>jenis_kelamin</th>\n",
" <th>date_of_birth</th>\n",
" <th>join_date</th>\n",
" <th>resign_date</th>\n",
" <th>marriage_stat</th>\n",
" <th>dependant</th>\n",
" <th>education</th>\n",
" <th>absent_90D</th>\n",
" <th>avg_time_work</th>\n",
" <th>departemen</th>\n",
" <th>position</th>\n",
" <th>income</th>\n",
" <th>total_komp</th>\n",
" <th>job_satisfaction</th>\n",
" <th>performance_rating</th>\n",
" <th>churn_status</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>EM0001</td>\n",
" <td>Kabupaten Bogor</td>\n",
" <td>Laki-laki</td>\n",
" <td>1970-09-10</td>\n",
" <td>2024-01-04</td>\n",
" <td>NaN</td>\n",
" <td>Married</td>\n",
" <td>2</td>\n",
" <td>S1</td>\n",
" <td>1.0</td>\n",
" <td>9.34</td>\n",
" <td>Engineering &amp; IT</td>\n",
" <td>Junior</td>\n",
" <td>5198046</td>\n",
" <td>NaN</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>EM0002</td>\n",
" <td>Kota Jakarta Selatan</td>\n",
" <td>Laki-laki</td>\n",
" <td>1980-12-09</td>\n",
" <td>2021-01-05</td>\n",
" <td>2023-04-22</td>\n",
" <td>Married</td>\n",
" <td>3</td>\n",
" <td>SLTA</td>\n",
" <td>11.0</td>\n",
" <td>9.86</td>\n",
" <td>Service &amp; Support</td>\n",
" <td>Staff</td>\n",
" <td>1281761</td>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>EM0003</td>\n",
" <td>Tangerang</td>\n",
" <td>Laki-laki</td>\n",
" <td>1987-04-25</td>\n",
" <td>2022-01-17</td>\n",
" <td>2024-01-31</td>\n",
" <td>Single</td>\n",
" <td>0</td>\n",
" <td>D2</td>\n",
" <td>3.0</td>\n",
" <td>9.66</td>\n",
" <td>Creative &amp; Design</td>\n",
" <td>Staff</td>\n",
" <td>4902208</td>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>EM0004</td>\n",
" <td>Kepulauan Seribu</td>\n",
" <td>Laki-laki</td>\n",
" <td>1975-12-24</td>\n",
" <td>2022-01-26</td>\n",
" <td>NaN</td>\n",
" <td>Married</td>\n",
" <td>1</td>\n",
" <td>S1</td>\n",
" <td>1.0</td>\n",
" <td>9.54</td>\n",
" <td>Marketing</td>\n",
" <td>Junior</td>\n",
" <td>6410492</td>\n",
" <td>NaN</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>EM0005</td>\n",
" <td>Kota Jakarta Utara</td>\n",
" <td>Laki-laki</td>\n",
" <td>1987-06-15</td>\n",
" <td>2022-01-31</td>\n",
" <td>2023-02-21</td>\n",
" <td>Single</td>\n",
" <td>0</td>\n",
" <td>SLTA</td>\n",
" <td>1.0</td>\n",
" <td>9.14</td>\n",
" <td>Operations</td>\n",
" <td>Staff</td>\n",
" <td>1208627</td>\n",
" <td>NaN</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" employee_id domisili jenis_kelamin date_of_birth join_date \\\n",
"0 EM0001 Kabupaten Bogor Laki-laki 1970-09-10 2024-01-04 \n",
"1 EM0002 Kota Jakarta Selatan Laki-laki 1980-12-09 2021-01-05 \n",
"2 EM0003 Tangerang Laki-laki 1987-04-25 2022-01-17 \n",
"3 EM0004 Kepulauan Seribu Laki-laki 1975-12-24 2022-01-26 \n",
"4 EM0005 Kota Jakarta Utara Laki-laki 1987-06-15 2022-01-31 \n",
"\n",
" resign_date marriage_stat dependant education absent_90D avg_time_work \\\n",
"0 NaN Married 2 S1 1.0 9.34 \n",
"1 2023-04-22 Married 3 SLTA 11.0 9.86 \n",
"2 2024-01-31 Single 0 D2 3.0 9.66 \n",
"3 NaN Married 1 S1 1.0 9.54 \n",
"4 2023-02-21 Single 0 SLTA 1.0 9.14 \n",
"\n",
" departemen position income total_komp job_satisfaction \\\n",
"0 Engineering & IT Junior 5198046 NaN 2 \n",
"1 Service & Support Staff 1281761 NaN 1 \n",
"2 Creative & Design Staff 4902208 NaN 1 \n",
"3 Marketing Junior 6410492 NaN 2 \n",
"4 Operations Staff 1208627 NaN 2 \n",
"\n",
" performance_rating churn_status \n",
"0 2 0 \n",
"1 2 1 \n",
"2 3 1 \n",
"3 1 0 \n",
"4 2 1 "
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\lib\\site-packages\\numpy\\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service\n",
" from . import _distributor_init\n"
]
},
{
"ename": "ImportError",
"evalue": "Unable to import required dependencies:\nnumpy: \n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.10 from \"c:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\python.exe\"\n * The NumPy version is: \"1.21.5\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: No module named 'numpy.core._multiarray_umath'\n",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mpandas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mpd\u001b[39;00m\n\u001b[0;32m 2\u001b[0m data \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mD:\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mTugas Akhir\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mCodingan\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mDevelopment\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mApp\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124motebook\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mpreprocessed_data_train_1.csv\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 3\u001b[0m data\u001b[38;5;241m.\u001b[39mhead()\n",
"File \u001b[1;32mc:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\lib\\site-packages\\pandas\\__init__.py:16\u001b[0m\n\u001b[0;32m 13\u001b[0m missing_dependencies\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdependency\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00me\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m missing_dependencies:\n\u001b[1;32m---> 16\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to import required dependencies:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(missing_dependencies)\n\u001b[0;32m 18\u001b[0m )\n\u001b[0;32m 19\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m hard_dependencies, dependency, missing_dependencies\n\u001b[0;32m 21\u001b[0m \u001b[38;5;66;03m# numpy compat\u001b[39;00m\n",
"\u001b[1;31mImportError\u001b[0m: Unable to import required dependencies:\nnumpy: \n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.10 from \"c:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\python.exe\"\n * The NumPy version is: \"1.21.5\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: No module named 'numpy.core._multiarray_umath'\n"
]
}
],
"source": [
"import pandas as pd\n",
"data = pd.read_csv('D:\\Tugas Akhir\\Codingan\\Development\\Data\\data_train.csv')\n",
"data = pd.read_csv('D:\\Tugas Akhir\\Codingan\\Development\\App\\notebook\\preprocessed_data_train_1.csv')\n",
"data.head()"
]
},
@ -5375,7 +5210,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.10.16"
}
},
"nbformat": 4,

View File

@ -23,224 +23,24 @@
},
"outputs": [
{
"data": {
"text/html": [
"<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>employee_id</th>\n",
" <th>domisili</th>\n",
" <th>jenis_kelamin</th>\n",
" <th>date_of_birth</th>\n",
" <th>join_date</th>\n",
" <th>resign_date</th>\n",
" <th>marriage_stat</th>\n",
" <th>dependant</th>\n",
" <th>education</th>\n",
" <th>absent_90D</th>\n",
" <th>...</th>\n",
" <th>active_work_category</th>\n",
" <th>work_stability_score</th>\n",
" <th>married_dependent_ratio</th>\n",
" <th>position_score</th>\n",
" <th>job_income_position_score</th>\n",
" <th>education_score</th>\n",
" <th>education_income_ratio</th>\n",
" <th>weighted_satisfaction_performance</th>\n",
" <th>resign_risk_indicator</th>\n",
" <th>adjusted_work_time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>EM0001</td>\n",
" <td>Kabupaten Bogor</td>\n",
" <td>Laki-laki</td>\n",
" <td>1970-09-10</td>\n",
" <td>2024-01-04</td>\n",
" <td>2024-10-31</td>\n",
" <td>Married</td>\n",
" <td>2</td>\n",
" <td>S1</td>\n",
" <td>1.0</td>\n",
" <td>...</td>\n",
" <td>Short-term</td>\n",
" <td>5.00</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>2599023.0</td>\n",
" <td>5</td>\n",
" <td>1.039609e+06</td>\n",
" <td>2.0</td>\n",
" <td>Medium</td>\n",
" <td>9.329634</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>EM0002</td>\n",
" <td>Kota Jakarta Selatan</td>\n",
" <td>Laki-laki</td>\n",
" <td>1980-12-09</td>\n",
" <td>2021-01-05</td>\n",
" <td>2023-04-22</td>\n",
" <td>Married</td>\n",
" <td>3</td>\n",
" <td>SLTA</td>\n",
" <td>11.0</td>\n",
" <td>...</td>\n",
" <td>Mid-term</td>\n",
" <td>2.25</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" <td>1281761.0</td>\n",
" <td>1</td>\n",
" <td>1.281761e+06</td>\n",
" <td>1.4</td>\n",
" <td>Medium</td>\n",
" <td>9.815385</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>EM0003</td>\n",
" <td>Tangerang</td>\n",
" <td>Laki-laki</td>\n",
" <td>1987-04-25</td>\n",
" <td>2022-01-17</td>\n",
" <td>2024-01-31</td>\n",
" <td>Single</td>\n",
" <td>0</td>\n",
" <td>D2</td>\n",
" <td>3.0</td>\n",
" <td>...</td>\n",
" <td>Mid-term</td>\n",
" <td>6.00</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>4902208.0</td>\n",
" <td>3</td>\n",
" <td>1.634069e+06</td>\n",
" <td>1.8</td>\n",
" <td>Medium</td>\n",
" <td>9.646590</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>EM0004</td>\n",
" <td>Kepulauan Seribu</td>\n",
" <td>Laki-laki</td>\n",
" <td>1975-12-24</td>\n",
" <td>2022-01-26</td>\n",
" <td>2024-10-31</td>\n",
" <td>Married</td>\n",
" <td>1</td>\n",
" <td>S1</td>\n",
" <td>1.0</td>\n",
" <td>...</td>\n",
" <td>Mid-term</td>\n",
" <td>16.50</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>3205246.0</td>\n",
" <td>5</td>\n",
" <td>1.282098e+06</td>\n",
" <td>1.6</td>\n",
" <td>Medium</td>\n",
" <td>9.536789</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>EM0005</td>\n",
" <td>Kota Jakarta Utara</td>\n",
" <td>Laki-laki</td>\n",
" <td>1987-06-15</td>\n",
" <td>2022-01-31</td>\n",
" <td>2023-02-21</td>\n",
" <td>Single</td>\n",
" <td>0</td>\n",
" <td>SLTA</td>\n",
" <td>1.0</td>\n",
" <td>...</td>\n",
" <td>Mid-term</td>\n",
" <td>6.00</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1208627.0</td>\n",
" <td>1</td>\n",
" <td>1.208627e+06</td>\n",
" <td>2.0</td>\n",
" <td>Medium</td>\n",
" <td>9.131545</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 37 columns</p>\n",
"</div>"
],
"text/plain": [
" employee_id domisili jenis_kelamin date_of_birth join_date \\\n",
"0 EM0001 Kabupaten Bogor Laki-laki 1970-09-10 2024-01-04 \n",
"1 EM0002 Kota Jakarta Selatan Laki-laki 1980-12-09 2021-01-05 \n",
"2 EM0003 Tangerang Laki-laki 1987-04-25 2022-01-17 \n",
"3 EM0004 Kepulauan Seribu Laki-laki 1975-12-24 2022-01-26 \n",
"4 EM0005 Kota Jakarta Utara Laki-laki 1987-06-15 2022-01-31 \n",
"\n",
" resign_date marriage_stat dependant education absent_90D ... \\\n",
"0 2024-10-31 Married 2 S1 1.0 ... \n",
"1 2023-04-22 Married 3 SLTA 11.0 ... \n",
"2 2024-01-31 Single 0 D2 3.0 ... \n",
"3 2024-10-31 Married 1 S1 1.0 ... \n",
"4 2023-02-21 Single 0 SLTA 1.0 ... \n",
"\n",
" active_work_category work_stability_score married_dependent_ratio \\\n",
"0 Short-term 5.00 3 \n",
"1 Mid-term 2.25 4 \n",
"2 Mid-term 6.00 1 \n",
"3 Mid-term 16.50 2 \n",
"4 Mid-term 6.00 1 \n",
"\n",
" position_score job_income_position_score education_score \\\n",
"0 2 2599023.0 5 \n",
"1 1 1281761.0 1 \n",
"2 1 4902208.0 3 \n",
"3 2 3205246.0 5 \n",
"4 1 1208627.0 1 \n",
"\n",
" education_income_ratio weighted_satisfaction_performance \\\n",
"0 1.039609e+06 2.0 \n",
"1 1.281761e+06 1.4 \n",
"2 1.634069e+06 1.8 \n",
"3 1.282098e+06 1.6 \n",
"4 1.208627e+06 2.0 \n",
"\n",
" resign_risk_indicator adjusted_work_time \n",
"0 Medium 9.329634 \n",
"1 Medium 9.815385 \n",
"2 Medium 9.646590 \n",
"3 Medium 9.536789 \n",
"4 Medium 9.131545 \n",
"\n",
"[5 rows x 37 columns]"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\lib\\site-packages\\numpy\\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service\n",
" from . import _distributor_init\n"
]
},
{
"ename": "ImportError",
"evalue": "Unable to import required dependencies:\nnumpy: \n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.10 from \"c:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\python.exe\"\n * The NumPy version is: \"1.21.5\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: No module named 'numpy.core._multiarray_umath'\n",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mpandas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mpd\u001b[39;00m\n\u001b[0;32m 3\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mD:\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mTugas Akhir\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mCodingan\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mDevelopment\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mData\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mpreprocessed_data_train.csv\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 4\u001b[0m df\u001b[38;5;241m.\u001b[39mhead()\n",
"File \u001b[1;32mc:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\lib\\site-packages\\pandas\\__init__.py:16\u001b[0m\n\u001b[0;32m 13\u001b[0m missing_dependencies\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdependency\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00me\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m missing_dependencies:\n\u001b[1;32m---> 16\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\n\u001b[0;32m 17\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to import required dependencies:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(missing_dependencies)\n\u001b[0;32m 18\u001b[0m )\n\u001b[0;32m 19\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m hard_dependencies, dependency, missing_dependencies\n\u001b[0;32m 21\u001b[0m \u001b[38;5;66;03m# numpy compat\u001b[39;00m\n",
"\u001b[1;31mImportError\u001b[0m: Unable to import required dependencies:\nnumpy: \n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.10 from \"c:\\Users\\Jesselyn Mu\\anaconda3\\envs\\myenv\\python.exe\"\n * The NumPy version is: \"1.21.5\"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: No module named 'numpy.core._multiarray_umath'\n"
]
}
],
"source": [
@ -2199,7 +1999,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.10.16"
}
},
"nbformat": 4,

View File

@ -241,11 +241,13 @@ def show_home():
<div class="text-content">
<h2 class="section-title">Bagian Aplikasi</h2>
<p style="text-align: justify;">
Aplikasi ini dirancang untuk mendukung prediksi retensi karyawan dan pengelolaan data dengan fitur-fitur yang terstruktur berdasarkan peran pengguna.
Halaman login menjadi pintu masuk utama untuk autentikasi, setelah itu pengguna diarahkan ke halaman sesuai perannya: admin, karyawan, atau pimpinan.
Admin memiliki akses ke halaman prediksi untuk analisis data, dashboard untuk memantau statistik, dan halaman laporan untuk melihat detail data.
Karyawan dapat mengisi form kepuasan kerja untuk memberikan umpan balik terkait pengalaman mereka.
Sementara itu, pimpinan dapat menggunakan dashboard untuk melihat data strategis serta mengisi form penilaian kinerja guna mengevaluasi performa karyawan.
Aplikasi ini dirancang untuk mendukung prediksi retensi karyawan dan pengelolaan data
dengan fitur-fitur yang terstruktur berdasarkan peran pengguna.
Dimulai dari Halaman Utama, pengguna diarahkan ke Halaman Login,
yang kemudian membagi akses berdasarkan peran: Admin, Karyawan, dan Pimpinan.
Admin memiliki akses ke Halaman Prediksi, Halaman Dashboard, dan Halaman Laporan untuk mengelola data dan analisis.
Karyawan dapat mengisi Form Kepuasan Kerja dan Form Komplain untuk memberikan feedback dan keluhan.
Pimpinan memiliki akses ke Form Penilaian untuk evaluasi serta Halaman Dashboard untuk melihat data yang relevan.
Aplikasi ini dirancang untuk mempermudah pengelolaan dan pengambilan keputusan berbasis data.
</p>
</div>
@ -254,7 +256,6 @@ def show_home():
unsafe_allow_html=True
)
# Berita dan Informasi
st.markdown(
f"""
<div class="news-section">
@ -274,7 +275,6 @@ def show_home():
unsafe_allow_html=True
)
# Footer
st.markdown(
"""
<div class="footer">
@ -285,13 +285,10 @@ def show_home():
unsafe_allow_html=True
)
def get_image_as_base64(image_path):
import base64
with open(image_path, "rb") as img_file:
return base64.b64encode(img_file.read()).decode("utf-8")
# Jalankan aplikasi
if __name__ == "__main__":
show_home()

View File

@ -462,41 +462,7 @@ def show_prediction():
col1, col2 = st.columns([1.5, 2]) # **Kolom pertama untuk grafik, kolom kedua untuk penjelasan**
with col1:
# st.image(buf, caption="SHAP Waterfall Plot", use_container_width=True)
# Tambahkan CSS styling ke HTML
st.markdown(
"""
<style>
.shap-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 10px;
}
.shap-image {
border-radius: 10px; /* Sudut membulat */
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2); /* Shadow */
border: 2px solid #ddd; /* Stroke */
padding: 5px; /* Ruang di dalam border */
background: white; /* Biar keliatan efeknya */
max-width: 100%; /* Biar responsif */
}
.shap-caption {
text-align: center;
font-size: 14px;
font-family: 'Poppins', sans-serif;
color: #555;
margin-top: 5px;
}
</style>
""",
unsafe_allow_html=True
)
# Gunakan `st.image()` untuk menampilkan gambar SHAP dari `buf`
st.markdown('<div class="shap-container">', unsafe_allow_html=True)
st.image(buf, caption="SHAP Waterfall Plot", use_container_width=True)
st.markdown('</div>', unsafe_allow_html=True)
with col2:
top_factors = sorted(shap_dict.items(), key=lambda x: abs(x[1]), reverse=True)[:5]