ahmadluay commited on
Commit
c243ecb
1 Parent(s): 2d173b8

edit predict.py (edit region_category,membership_category,joined_through_referral,preferred_offer_types, medium_of_operation, internet_option, used_special_discount, offer_application_preference, past_complaint, complaint_statusm complaint_status)

Browse files
Files changed (1) hide show
  1. prediction.py +19 -20
prediction.py CHANGED
@@ -24,27 +24,26 @@ def run():
24
  if gender=='Male':
25
  gender='M'
26
  else: gender='F'
27
- region_category = st.selectbox('Region Category',('Town', 'City','Village'))
28
- membership_category = st.selectbox('Membership Category',('Premium Membership','Basic Membership','No Membership', 'Gold Membership','Silver Membership','Platinum Membership'))
29
- joining_date = st.date_input('Joining Date',datetime.date(2015,3,27))
30
- joined_through_referral = st.selectbox('Joined Through Referral',('Yes','No'))
31
- preferred_offer_types = st.selectbox('Preferred Offer Types',('Credit/Debit Card Offers','Gift Vouchers/Coupons','Without Offers'))
32
- medium_of_operation = st.selectbox('Medium of Operation',('Smartphone','Desktop','Both'))
33
- internet_option = st.selectbox('Internet Option',('Mobile_Data','Wi-Fi','Fiber_Optic'))
34
- last_visit_time = st.text_input('Last Visit Time',value='09:41:40')
35
  days_since_last_login = st.number_input('Days Since Last Login',min_value=0,max_value=31,value=16)
36
- avg_time_spent = st.number_input('Average Time Spent on the Website',step=0.000001,format="%.6f",min_value=0.000000,max_value=9999.999999,value=1447.387929)
37
  avg_transaction_value = st.number_input('Average Transaction Value',step=0.01,format="%.2f",min_value=0.00,max_value=99999.99,value=11839.58)
38
- avg_frequency_login_days = st.number_input('Number of Times Login to the Website',min_value=1, max_value=99,value=29)
39
  points_in_wallet = st.number_input('Points Balance',step=0.01,format="%.2f",min_value=0.00,max_value=9999.99,value=727.91)
40
- used_special_discount = st.selectbox('Uses Special Discount Offered ?',('Yes','No'))
41
- offer_application_preference = st.selectbox('Prefer Offers ?',('No','Yes'))
42
- past_complaint = st.selectbox(' Has raised any complaints before ?',('No','Yes'))
43
- complaint_status = st.selectbox('Were the complaints raised resolved?',('Not Applicable ','Unsolved','Solved','Solved in Follow-up','No Information Available'))
44
- feedback = st.text_input('Feedback',value='No reason specified')
45
 
46
- st.markdown('---')
47
- submitted = st.form_submit_button('Are Customers at Risk of Churning ? :thinking_face:')
48
 
49
  df_inf = {
50
  'user_id': user_id,
@@ -85,11 +84,11 @@ def run():
85
  if submitted:
86
  # Predict using Neural Network
87
  y_pred_inf = model_seq2.predict(data_inf_transform)
88
- st.write('# Are Customers at Risk of Churning ? :thinking_face:')
89
  if y_pred_inf == 0:
90
- st.subheader('Yes, customers are at risk of churning :disappointed: ')
91
  else:
92
- st.subheader('No, customers are not at risk of churning :wink:')
93
 
94
  if __name__ == '__main__':
95
  run()
 
24
  if gender=='Male':
25
  gender='M'
26
  else: gender='F'
27
+ region_category = st.radio('Region Category',('Town', 'City','Village'))
28
+ membership_category = st.radio('Membership Category',('Premium Membership','Basic Membership','No Membership', 'Gold Membership','Silver Membership','Platinum Membership'))
29
+ joining_date = st.date_input('Joining Date',datetime.date(2015,3,27),help='YYYY-MM-DD')
30
+ joined_through_referral = st.radio('Did you join using the referral code?',('No','Yes'))
31
+ preferred_offer_types = st.radio('What is your preferred offer types?',('Credit/Debit Card Offers','Gift Vouchers/Coupons','Without Offers'))
32
+ medium_of_operation = st.radio('What device do you usually use?',('Smartphone','Desktop','Both'))
33
+ internet_option = st.radio('What type of network connection do you usually use?',('Mobile_Data','Wi-Fi','Fiber_Optic'))
34
+ last_visit_time = st.text_input('When was the last time you visited?',value='09:41:40',help='HH:mm:ss')
35
  days_since_last_login = st.number_input('Days Since Last Login',min_value=0,max_value=31,value=16)
36
+ avg_time_spent = st.number_input('Average Time Spent on the Website',step=0.01,format="%.2f",min_value=0.00,max_value=9999.99,value=1447.39)
37
  avg_transaction_value = st.number_input('Average Transaction Value',step=0.01,format="%.2f",min_value=0.00,max_value=99999.99,value=11839.58)
38
+ avg_frequency_login_days = st.number_input('Frequency of logins per day',min_value=1, max_value=99,value=29)
39
  points_in_wallet = st.number_input('Points Balance',step=0.01,format="%.2f",min_value=0.00,max_value=9999.99,value=727.91)
40
+ used_special_discount = st.radio('Have you ever used a special discount offer?',('No','Yes'))
41
+ offer_application_preference = st.radio('Do you prefer offers through an application?',('No','Yes'))
42
+ past_complaint = st.radio('Have you ever raised any complaints before ?',('No','Yes'))
43
+ complaint_status = st.radio('Was the complaint resolved ?',('Not Applicable ','Unsolved','Solved','Solved in Follow-up','No Information Available'),help='Select "Not Applicable" if you have never raised a complaint.')
44
+ feedback = st.radio('Any feedback for us?',('No reason specified','Poor Product Quality','Too many ads', 'Poor Website', 'Poor Customer Service', 'Reasonable Price', 'User Friendly Website', 'Products always in Stock', 'Quality Customer Care'))
45
 
46
+ submitted = st.form_submit_button('Is the customer at risk of churning ? :thinking_face:')
 
47
 
48
  df_inf = {
49
  'user_id': user_id,
 
84
  if submitted:
85
  # Predict using Neural Network
86
  y_pred_inf = model_seq2.predict(data_inf_transform)
87
+ #st.write('# Is the customer at risk of churning ? :thinking_face:')
88
  if y_pred_inf == 0:
89
+ st.subheader('Yes, the customer is at risk of churning :disappointed: ')
90
  else:
91
+ st.subheader('No, the customer is not at risk of churning :wink:')
92
 
93
  if __name__ == '__main__':
94
  run()