Bjerring98 commited on
Commit
67bfbbe
·
verified ·
1 Parent(s): 7333c2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
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
- # Age group labels with age ranges
454
- age_group_labels = [
455
- 'Teen (13-18)',
456
- 'Young Adult (19-24)',
457
- 'Adult (25-34)',
458
- 'Middle Age (35-44)',
459
- 'Older Adult (45-54)',
460
- 'Senior (55-64)',
461
- 'Elder (65-110)'
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', age_group_labels) # Dropdown with age ranges
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
- columns=ohe.get_feature_names_out(['Place of living', 'Education Level', 'Age Group']))
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)