Update app.py
Browse files
app.py
CHANGED
@@ -93,11 +93,14 @@ 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 |
# Offer recommendations for retaining the employee
|
103 |
st.subheader("Suggestions for retaining the employee:")
|
@@ -109,8 +112,5 @@ def main():
|
|
109 |
st.markdown("- Introduce or enhance policies that support work-life balance for employees with families.")
|
110 |
st.markdown("- Recognize the unique challenges and opportunities within each department and tailor retention strategies accordingly.")
|
111 |
|
112 |
-
# Display probability
|
113 |
-
st.write(f"Probability of Attrition: {probability[0]*100:.2f}%")
|
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 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:")
|
|
|
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()
|