Harsh12 commited on
Commit
f1784c0
·
1 Parent(s): 19dcf8e

Upload 6 files

Browse files
Files changed (6) hide show
  1. Employee_Promotion_Prediction.ipynb +0 -0
  2. app.py +109 -0
  3. rf.pkl +3 -0
  4. sc.pkl +3 -0
  5. test.csv +0 -0
  6. train.csv +0 -0
Employee_Promotion_Prediction.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+ import numpy as np
4
+
5
+ # Set page title and icon
6
+ st.set_page_config(page_title="Employee Promotion Prediction", page_icon=":guardsman:", layout="wide")
7
+
8
+ # Add a big heading
9
+ st.title("Employee Promotion Prediction")
10
+
11
+ # Change background color to black
12
+ st.markdown(
13
+ """
14
+ <style>
15
+ .reportview-container {
16
+ background: black
17
+ }
18
+ </style>
19
+ """,
20
+ unsafe_allow_html=True
21
+ )
22
+
23
+ model = pickle.load(open('rf.pkl', 'rb'))
24
+ scaling = pickle.load(open('sc.pkl', 'rb'))
25
+
26
+ # Define the department options
27
+ department_options = ['Analytics', 'Finance', 'HR', 'Legal', 'Operations', 'Procurement', 'R&D', 'Sales & Marketing', 'Technology']
28
+
29
+ # Define the education options
30
+ education_options = ["Bachelor's", "Master's & above", "Below Secondary"]
31
+
32
+ # Define the gender options
33
+ gender_options = ['Male', 'Female']
34
+
35
+ # Define the awards won options
36
+ awards_won_options = ['No', 'Yes']
37
+
38
+ # Define the maximum training score
39
+ max_training_score = 100
40
+
41
+ # Define the maximum number of trainings
42
+ max_trainings = 10
43
+
44
+ # Define the minimum and maximum age
45
+ min_age, max_age = 18, 60
46
+
47
+ # Define the minimum and maximum length of service
48
+ min_service_length, max_service_length = 0, 20
49
+
50
+ # Define the minimum and maximum previous year rating
51
+ min_prev_year_rating, max_prev_year_rating = 1, 5
52
+
53
+
54
+ # Define the input components using Streamlit
55
+
56
+ department = st.selectbox('---> Department', department_options)
57
+ education = st.selectbox('---> Education', education_options)
58
+ gender = st.radio('---> Gender', gender_options)
59
+ no_of_trainings = st.number_input('---> Number of Trainings', min_value=1, max_value=max_trainings, value=1)
60
+ age = st.slider('---> Age', min_value=min_age, max_value=max_age)
61
+ previous_year_rating = st.slider('---> Previous Year Rating', min_value=min_prev_year_rating, max_value=max_prev_year_rating)
62
+ length_of_service = st.number_input('---> Length of Service', min_value=min_service_length, max_value=max_service_length, value=0)
63
+ awards_won = st.selectbox('---> Awards Won?', awards_won_options)
64
+ avg_training_score = st.number_input('---> Average Training Score', max_value=max_training_score)
65
+
66
+
67
+ department_encoding = {'Analytics':0, 'Finance':1, 'HR':2, 'Legal':3, 'Operations':4, 'Procurement':5, 'R&D':6, 'Sales & Marketing':7, 'Technology':8}
68
+ education_encoding = {"Bachelor's":2, "Master's & above":3, "Below Secondary":1}
69
+ gender_encoding = {'Male':1, 'Female':0}
70
+ awards_won_encoding = {'No':0, 'Yes':1}
71
+
72
+ sum_metric = awards_won_encoding[awards_won] + previous_year_rating
73
+ total_score = avg_training_score * no_of_trainings
74
+
75
+ inputs_to_model = np.array([(department_encoding[department], education_encoding[education],
76
+ gender_encoding[gender], no_of_trainings, age, previous_year_rating,
77
+ length_of_service, awards_won_encoding[awards_won], avg_training_score,
78
+ sum_metric, total_score)])
79
+
80
+ final_inputs = scaling.transform(inputs_to_model)
81
+
82
+ # Print the user inputs
83
+ if st.button('Submit'):
84
+ # st.write('Department:', department)
85
+ # st.write('Education:', education)
86
+ # st.write('Gender:', gender)
87
+ # st.write('Number of Trainings:', no_of_trainings)
88
+ # st.write('Age:', age)
89
+ # st.write('Previous Year Rating:', previous_year_rating)
90
+ # st.write('Length of Service:', length_of_service)
91
+ # st.write('KPIs Met >80%:', kpis_met)
92
+ # st.write('Awards Won?:', awards_won)
93
+ # st.write('Average Training Score:', avg_training_score)
94
+ # st.write('sum metric', sum_metric)
95
+ # st.write('total score', total_score)
96
+ # st.write('model inputs', inputs_to_model)
97
+ # st.write('final model inputs', final_inputs)
98
+
99
+ prediction = model.predict(final_inputs)
100
+
101
+ if prediction[0] == 1:
102
+ st.header('The Employee should get Promotion')
103
+
104
+ else:
105
+ st.header('The Employee should not get promotion')
106
+
107
+
108
+
109
+
rf.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aece73a4bf7b52dbac4b21787dc09c21d70e599c03b623457bdaea604c50f263
3
+ size 121765830
sc.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e22cb6a37283735100599825a9a93132f9dab5883b3ca7d64292d49973a460d
3
+ size 963
test.csv ADDED
The diff for this file is too large to render. See raw diff
 
train.csv ADDED
The diff for this file is too large to render. See raw diff