HOLYBOY commited on
Commit
cb2df97
1 Parent(s): bce0bd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -9,13 +9,6 @@ import matplotlib.pyplot as plt
9
  from io import BytesIO
10
 
11
 
12
-
13
- # num_imputer = joblib.load('C:/Users/user/Desktop/Churn_Prediction_ML/models/numerical_imputer.joblib')
14
- # cat_imputer = joblib.load('C:/Users/user/Desktop/Churn_Prediction_ML/models/cat_imputer.joblib')
15
- # encoder = joblib.load('C:/Users/user/Desktop/Churn_Prediction_ML/models/encoder.joblib')
16
- # scaler = joblib.load('C:/Users/user/Desktop/Churn_Prediction_ML/models/scaler.joblib')
17
- # lr_model = joblib.load('C:/Users/user/Desktop/Churn_Prediction_ML/models/lr_smote_model.joblib')
18
-
19
  num_imputer = joblib.load('numerical_imputer.joblib')
20
  cat_imputer = joblib.load('cat_imputer.joblib')
21
  encoder = joblib.load('encoder.joblib')
@@ -57,7 +50,7 @@ original_feature_names = ['MONTANT', 'FREQUENCE_RECH', 'REVENUE', 'ARPU_SEGMENT'
57
  st.set_page_config(layout="wide")
58
 
59
  # Main page - Churn Prediction
60
- st.title('CUSTOMER CHURN PREDICTION APP ')
61
 
62
  # Main page - Churn Prediction
63
  st.markdown("Churn is a one of the biggest problem in the telecom industry. Research has shown that the average monthly churn rate among the top 4 wireless carriers in the US is 1.9% - 2%")
@@ -82,10 +75,10 @@ model_type = models[model_name]['type']
82
 
83
 
84
  # Collect input from the user
85
- st.sidebar.title('Enter Customer Details')
86
  input_features = {
87
  'MONTANT': st.sidebar.number_input('Top-up Amount (MONTANT)'),
88
- 'FREQUENCE_RECH': st.sidebar.number_input('Number of Times the Customer Refilled (FREQUENCE_RECH)'),
89
  'REVENUE': st.sidebar.number_input('Monthly income of the client (REVENUE)'),
90
  'ARPU_SEGMENT': st.sidebar.number_input('Income over 90 days / 3 (ARPU_SEGMENT)'),
91
  'FREQUENCE': st.sidebar.number_input('Number of times the client has made an income (FREQUENCE)'),
@@ -208,7 +201,6 @@ if st.sidebar.button('Predict Churn'):
208
  "- It\s crucial to genuinely address their concerns and provide value to rebuild their trust in your business\n"
209
  "- Regularly evaluate the effectiveness of your strategies and adjust them as needed based on customer responses and feedback\n")
210
  else:
211
- #churn_index = churn_indices["No Churn"]
212
  churn_prob = churn_probability[churn_index]
213
  with col1:
214
  st.success(f"This customer is not likely to churn with a probability of {churn_prob * 100:.2f}% 😀")
@@ -296,7 +288,7 @@ if st.sidebar.button('Predict Churn'):
296
  else:
297
  churn_comparison = "equal"
298
 
299
- explanation = f"This bar chart compares the churn probability of the selected customer " \
300
  f"with the average churn rate of all customers. It provides insights into how the " \
301
  f"individual customer's churn likelihood ({predicted_churn_prob:.2f}) compares to the " \
302
  f"overall trend. The 'Churn Probability' represents the likelihood of churn " \
 
9
  from io import BytesIO
10
 
11
 
 
 
 
 
 
 
 
12
  num_imputer = joblib.load('numerical_imputer.joblib')
13
  cat_imputer = joblib.load('cat_imputer.joblib')
14
  encoder = joblib.load('encoder.joblib')
 
50
  st.set_page_config(layout="wide")
51
 
52
  # Main page - Churn Prediction
53
+ st.title('CUSTOMER CHURN PREDICTION APP')
54
 
55
  # Main page - Churn Prediction
56
  st.markdown("Churn is a one of the biggest problem in the telecom industry. Research has shown that the average monthly churn rate among the top 4 wireless carriers in the US is 1.9% - 2%")
 
75
 
76
 
77
  # Collect input from the user
78
+ st.sidebar.title('ENTER CUSTOMER DETAILS')
79
  input_features = {
80
  'MONTANT': st.sidebar.number_input('Top-up Amount (MONTANT)'),
81
+ 'FREQUENCE_RECH': st.sidebar.number_input('No. of Times the Customer Refilled (FREQUENCE_RECH)'),
82
  'REVENUE': st.sidebar.number_input('Monthly income of the client (REVENUE)'),
83
  'ARPU_SEGMENT': st.sidebar.number_input('Income over 90 days / 3 (ARPU_SEGMENT)'),
84
  'FREQUENCE': st.sidebar.number_input('Number of times the client has made an income (FREQUENCE)'),
 
201
  "- It\s crucial to genuinely address their concerns and provide value to rebuild their trust in your business\n"
202
  "- Regularly evaluate the effectiveness of your strategies and adjust them as needed based on customer responses and feedback\n")
203
  else:
 
204
  churn_prob = churn_probability[churn_index]
205
  with col1:
206
  st.success(f"This customer is not likely to churn with a probability of {churn_prob * 100:.2f}% 😀")
 
288
  else:
289
  churn_comparison = "equal"
290
 
291
+ explanation = f"This compares the churn probability of the selected customer " \
292
  f"with the average churn rate of all customers. It provides insights into how the " \
293
  f"individual customer's churn likelihood ({predicted_churn_prob:.2f}) compares to the " \
294
  f"overall trend. The 'Churn Probability' represents the likelihood of churn " \