rasmodev commited on
Commit
a88018b
·
verified ·
1 Parent(s): 0c588fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -11
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 and probability
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
- # Show prediction probability
102
  st.subheader("Prediction Probability")
103
  st.write(f"The probability of the employee leaving is: {probability[0]*100:.2f}%")
104
-
105
- # Offer recommendations for retaining the employee
106
  st.subheader("Suggestions for retaining the employee:")
107
- st.markdown("- Invest in orientation programs and career development for entry-level staff, which could contribute to higher retention.")
108
- st.markdown("- Implement mentorship programs and career development initiatives aimed at engaging and retaining younger employees.")
109
- st.markdown("- Offer robust training and development programs and regular promotions to foster career growth. This investment in skills and career advancement can contribute to higher job satisfaction and retention.")
110
- st.markdown("- Recognize the diverse needs of employees based on marital status and consider tailoring benefits or support programs accordingly.")
111
- st.markdown("- Consider offering benefits that cater to the unique needs of married, single, and divorced employees.")
112
- st.markdown("- Introduce or enhance policies that support work-life balance for employees with families.")
113
- st.markdown("- Recognize the unique challenges and opportunities within each department and tailor retention strategies accordingly.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()