Spaces:
Runtime error
Runtime error
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- 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.
|
28 |
-
membership_category = st.
|
29 |
-
joining_date = st.date_input('Joining Date',datetime.date(2015,3,27))
|
30 |
-
joined_through_referral = st.
|
31 |
-
preferred_offer_types = st.
|
32 |
-
medium_of_operation = st.
|
33 |
-
internet_option = st.
|
34 |
-
last_visit_time = st.text_input('
|
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.
|
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('
|
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.
|
41 |
-
offer_application_preference = st.
|
42 |
-
past_complaint = st.
|
43 |
-
complaint_status = st.
|
44 |
-
feedback = st.
|
45 |
|
46 |
-
st.
|
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('#
|
89 |
if y_pred_inf == 0:
|
90 |
-
st.subheader('Yes,
|
91 |
else:
|
92 |
-
st.subheader('No,
|
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()
|