-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathpredict_old.py
More file actions
29 lines (26 loc) · 730 Bytes
/
predict_old.py
File metadata and controls
29 lines (26 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pickle
with open('model.bin', 'rb') as f_in:
pipeline = pickle.load(f_in)
datapoint = {
'gender': 'female',
'seniorcitizen': 0,
'partner': 'yes',
'dependents': 'no',
'phoneservice': 'no',
'multiplelines': 'no_phone_service',
'internetservice': 'dsl',
'onlinesecurity': 'no',
'onlinebackup': 'yes',
'deviceprotection': 'no',
'techsupport': 'no',
'streamingtv': 'no',
'streamingmovies': 'no',
'contract': 'month-to-month',
'paperlessbilling': 'yes',
'paymentmethod': 'electronic_check',
'tenure': 1,
'monthlycharges': 29.85,
'totalcharges': 29.85
}
result = pipeline.predict_proba(datapoint)[0, 1]
print(f'Probability of churn: {result:.3f}')