Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display predictions in categorical form #429

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Job Satisfaction Analysis/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,22 @@
input_df = input_df[features]

# Make prediction
prediction = model.predict(input_df)
prediction_numeric = model.predict(input_df)[0]

# Display the prediction
st.write(f'Predicted Job Satisfaction: {prediction[0]}')
satisfaction_categories = [
'Extremely dissatisfied',
'Moderately dissatisfied',
'Slightly dissatisfied',
'Neither satisfied nor dissatisfied',
'Slightly satisfied',
'Moderately satisfied',
'Extremely satisfied'
]

# Map numeric prediction to category label
prediction_label = satisfaction_categories[int(prediction_numeric)]

# Display the prediction in categorical form
st.write(f'Predicted Job Satisfaction: {prediction_label}')