Update app.py
Browse files
app.py
CHANGED
|
@@ -93,24 +93,38 @@ 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 |
-
#
|
| 102 |
st.subheader("Prediction Probability")
|
| 103 |
st.write(f"The probability of the employee leaving is: {probability[0]*100:.2f}%")
|
| 104 |
-
|
| 105 |
-
#
|
| 106 |
st.subheader("Suggestions for retaining the employee:")
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
if __name__ == "__main__":
|
| 116 |
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_role_satisfaction < 2:
|
| 108 |
+
st.write("Enhance job satisfaction through job enrichment initiatives and regular assessments of job roles.")
|
| 109 |
+
if years_since_last_promotion > 5:
|
| 110 |
+
st.write("Implement a transparent promotion policy and provide opportunities for career advancement to employees who haven't been promoted recently.")
|
| 111 |
+
if years_with_current_manager > 5:
|
| 112 |
+
st.write("Offer opportunities for a change in reporting structure to prevent stagnation and promote growth.")
|
| 113 |
+
if performance_rating < 3:
|
| 114 |
+
st.write("Provide constructive feedback and support for employees with low performance ratings to improve their performance and morale.")
|
| 115 |
+
if workload > 8:
|
| 116 |
+
st.write("Implement workload balancing and stress management programs to support employee well-being and prevent burnout.")
|
| 117 |
+
if career_development_opportunities == "Limited":
|
| 118 |
+
st.write("Offer continuous learning and development opportunities to foster employee growth and engagement.")
|
| 119 |
+
if feedback_mechanism == "Not Effective":
|
| 120 |
+
st.write("Establish open channels for feedback and regular one-on-one meetings to address employee concerns and development needs.")
|
| 121 |
+
if company_culture != "Aligned with Values":
|
| 122 |
+
st.write("Foster a positive work environment aligned with organizational values to enhance employee retention.")
|
| 123 |
+
if recognition_rewards == "Limited":
|
| 124 |
+
st.write("Implement reward programs and appreciation initiatives to recognize and acknowledge employees' contributions.")
|
| 125 |
+
|
| 126 |
+
# General recommendation for all negative predictions
|
| 127 |
+
st.write("Conduct exit interviews to gather feedback and identify areas for improvement in retention strategies.")
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
main()
|