Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -446,25 +446,25 @@ elif option == "Financial Recommender Engine":
|
|
| 446 |
else:
|
| 447 |
st.write("Click the 'Get Recommendations' button to receive personalized financial recommendations.")
|
| 448 |
|
| 449 |
-
|
| 450 |
elif option == "SML Classification":
|
| 451 |
st.markdown("<h2 style='text-align: center;'>SML Classification</h2>", unsafe_allow_html=True)
|
| 452 |
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
|
|
|
| 463 |
|
| 464 |
# Collect user inputs
|
| 465 |
place_of_living = st.selectbox('Place of Living', ['Urban Area', 'Rural Area', 'Unknown'])
|
| 466 |
education_level = st.selectbox('Education Level', ['Primary', 'Secondary', 'Tertiary'])
|
| 467 |
-
age_group = st.selectbox('Age Group',
|
| 468 |
income_bracket = st.selectbox('Income Bracket', [1, 2, 3, 4, 5])
|
| 469 |
female = st.radio('Gender', ['Female', 'Male'])
|
| 470 |
is_mobileowner = st.checkbox('Is Mobile Owner?')
|
|
@@ -485,12 +485,11 @@ elif option == "SML Classification":
|
|
| 485 |
'Has Internet Access': [1 if has_internet_access else 0],
|
| 486 |
'Employed': [1 if employed else 0],
|
| 487 |
'High Income Region': [1 if high_income_region else 0],
|
| 488 |
-
'Income Bracket': [income_bracket]
|
| 489 |
})
|
| 490 |
|
| 491 |
-
# OneHotEncode only the categorical variables
|
| 492 |
cat_encoded = pd.DataFrame(ohe.transform(cat_features),
|
| 493 |
-
|
| 494 |
|
| 495 |
# Combine categorical and numerical features
|
| 496 |
features = pd.concat([num_features, cat_encoded], axis=1)
|
|
|
|
| 446 |
else:
|
| 447 |
st.write("Click the 'Get Recommendations' button to receive personalized financial recommendations.")
|
| 448 |
|
|
|
|
| 449 |
elif option == "SML Classification":
|
| 450 |
st.markdown("<h2 style='text-align: center;'>SML Classification</h2>", unsafe_allow_html=True)
|
| 451 |
|
| 452 |
+
# Introduction to the SML Classification page
|
| 453 |
+
st.write("""
|
| 454 |
+
### Predicting Savings Behavior
|
| 455 |
+
This page uses a **Supervised Machine Learning** model to predict whether a person has saved money in the past year.
|
| 456 |
+
Based on the information you provide, the model will analyze your input and predict:
|
| 457 |
+
|
| 458 |
+
- **Saving habit is likely**: If the model predicts that you're likely to have saved money.
|
| 459 |
+
- **Saving habit is unlikely**: If the model predicts that you haven't likely saved money.
|
| 460 |
+
|
| 461 |
+
The prediction is based on variables such as your age, income, employment status, and other socioeconomic factors.
|
| 462 |
+
""")
|
| 463 |
|
| 464 |
# Collect user inputs
|
| 465 |
place_of_living = st.selectbox('Place of Living', ['Urban Area', 'Rural Area', 'Unknown'])
|
| 466 |
education_level = st.selectbox('Education Level', ['Primary', 'Secondary', 'Tertiary'])
|
| 467 |
+
age_group = st.selectbox('Age Group', ['Adult', 'Middle Age', 'Older Adult', 'Senior', 'Teen', 'Young Adult'])
|
| 468 |
income_bracket = st.selectbox('Income Bracket', [1, 2, 3, 4, 5])
|
| 469 |
female = st.radio('Gender', ['Female', 'Male'])
|
| 470 |
is_mobileowner = st.checkbox('Is Mobile Owner?')
|
|
|
|
| 485 |
'Has Internet Access': [1 if has_internet_access else 0],
|
| 486 |
'Employed': [1 if employed else 0],
|
| 487 |
'High Income Region': [1 if high_income_region else 0],
|
| 488 |
+
'Income Bracket': [income_bracket] # Directly use Income Bracket as numerical
|
| 489 |
})
|
| 490 |
|
|
|
|
| 491 |
cat_encoded = pd.DataFrame(ohe.transform(cat_features),
|
| 492 |
+
columns=ohe.get_feature_names_out(['Place of living', 'Education Level', 'Age Group']))
|
| 493 |
|
| 494 |
# Combine categorical and numerical features
|
| 495 |
features = pd.concat([num_features, cat_encoded], axis=1)
|