rasmodev commited on
Commit
94b741a
·
verified ·
1 Parent(s): 6f97b0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -33
app.py CHANGED
@@ -93,40 +93,40 @@ def main():
93
  prediction = model.predict(input_data)
94
  probability = model.predict_proba(input_data)[:, 1]
95
 
96
- # Display prediction
97
- if prediction[0] == 0:
98
- st.success("Employee is predicted to stay (Attrition = No)")
99
- else:
100
- st.error("Employee is predicted to leave (Attrition = Yes)")
101
- # Display probability
102
- st.subheader("Prediction Probability")
103
- st.write(f"The probability of the employee leaving is: {probability[0]*100:.2f}%")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- # Display characteristic-based recommendations
106
- st.subheader("Suggestions for retaining the employee:")
107
- if job_satisfaction == 1 or environment_satisfaction == 1:
108
- st.write("Enhance job and environment satisfaction through initiatives such as recognition programs and improving workplace conditions.")
109
- if years_since_last_promotion > 5:
110
- st.write("Implement a transparent promotion policy and provide opportunities for career advancement.")
111
- if years_with_curr_manager > 5:
112
- st.write("Offer opportunities for a change in reporting structure to prevent stagnation and promote growth.")
113
- if percent_salary_hike < 5:
114
- st.write("Consider adjusting salary and benefits packages to remain competitive and reward employee loyalty.")
115
- if training_times_last_year < 2:
116
- st.write("Invest in employee development through training programs and continuous learning opportunities.")
117
- if over_time:
118
- st.write("Evaluate workload distribution and consider implementing measures to prevent overwork, such as workload balancing and flexible scheduling.")
119
- if relationship_satisfaction == 1:
120
- st.write("Foster positive relationships and a supportive work environment through team-building activities and open communication channels.")
121
- if monthly_income < 5000:
122
- st.write("Review compensation structures and adjust salaries to align with industry standards and employee expectations.")
123
- if num_companies_worked > 5:
124
- st.write("Identify reasons for high turnover and address issues related to job stability, career progression, and organizational culture.")
125
- if work_life_balance == 1:
126
- st.write("Promote work-life balance initiatives, such as flexible work arrangements and wellness programs, to support employee well-being.")
127
-
128
- # General recommendation for all negative predictions
129
- st.write("Conduct exit interviews to gather feedback and identify areas for improvement in retention strategies.")
130
 
131
  if __name__ == "__main__":
132
  main()
 
93
  prediction = model.predict(input_data)
94
  probability = model.predict_proba(input_data)[:, 1]
95
 
96
+ # Convert integer inputs to integers
97
+ age = int(age)
98
+ monthly_income = int(monthly_income)
99
+ num_companies_worked = int(num_companies_worked)
100
+ percent_salary_hike = int(percent_salary_hike)
101
+ training_times_last_year = int(training_times_last_year)
102
+ years_since_last_promotion = int(years_since_last_promotion)
103
+ years_with_curr_manager = int(years_with_curr_manager)
104
+
105
+ # Display characteristic-based recommendations
106
+ st.subheader("Suggestions for retaining the employee:")
107
+ if job_satisfaction == 1 or environment_satisfaction == 1:
108
+ st.write("Enhance job and environment satisfaction through initiatives such as recognition programs and improving workplace conditions.")
109
+ if years_since_last_promotion > 5:
110
+ st.write("Implement a transparent promotion policy and provide opportunities for career advancement.")
111
+ if years_with_curr_manager > 5:
112
+ st.write("Offer opportunities for a change in reporting structure to prevent stagnation and promote growth.")
113
+ if percent_salary_hike < 5:
114
+ st.write("Consider adjusting salary and benefits packages to remain competitive and reward employee loyalty.")
115
+ if training_times_last_year < 2:
116
+ st.write("Invest in employee development through training programs and continuous learning opportunities.")
117
+ if over_time:
118
+ st.write("Evaluate workload distribution and consider implementing measures to prevent overwork, such as workload balancing and flexible scheduling.")
119
+ if relationship_satisfaction == 1:
120
+ st.write("Foster positive relationships and a supportive work environment through team-building activities and open communication channels.")
121
+ if monthly_income < 5000:
122
+ st.write("Review compensation structures and adjust salaries to align with industry standards and employee expectations.")
123
+ if num_companies_worked > 5:
124
+ st.write("Identify reasons for high turnover and address issues related to job stability, career progression, and organizational culture.")
125
+ if work_life_balance == 1:
126
+ st.write("Promote work-life balance initiatives, such as flexible work arrangements and wellness programs, to support employee well-being.")
127
 
128
+ # General recommendation for all negative predictions
129
+ st.write("Conduct exit interviews to gather feedback and identify areas for improvement in retention strategies.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  if __name__ == "__main__":
132
  main()