Spaces:
Sleeping
Sleeping
Update lapse_model.pkl
Browse files- lapse_model.pkl +16 -7
lapse_model.pkl
CHANGED
@@ -1,16 +1,25 @@
|
|
1 |
-
from xgboost import XGBClassifier
|
2 |
-
from sklearn.model_selection import train_test_split
|
3 |
import pandas as pd
|
|
|
4 |
import pickle
|
5 |
|
6 |
-
# Example dataset
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
|
|
9 |
X = df[["policy_term", "policy_age", "payment_mode_encoded", "communication_score"]]
|
10 |
y = df["lapse_label"]
|
11 |
|
12 |
-
|
|
|
13 |
model.fit(X, y)
|
14 |
|
15 |
-
# Save model
|
16 |
-
|
|
|
|
|
|
|
|
1 |
import pandas as pd
|
2 |
+
import xgboost as xgb
|
3 |
import pickle
|
4 |
|
5 |
+
# Example dummy dataset
|
6 |
+
data = {
|
7 |
+
"policy_term": [10, 15, 20],
|
8 |
+
"policy_age": [2, 5, 7],
|
9 |
+
"payment_mode_encoded": [0, 1, 2],
|
10 |
+
"communication_score": [0.3, 0.7, 0.5],
|
11 |
+
"lapse_label": [1, 0, 1]
|
12 |
+
}
|
13 |
+
df = pd.DataFrame(data)
|
14 |
|
15 |
+
# Split features and label
|
16 |
X = df[["policy_term", "policy_age", "payment_mode_encoded", "communication_score"]]
|
17 |
y = df["lapse_label"]
|
18 |
|
19 |
+
# Train model
|
20 |
+
model = xgb.XGBClassifier()
|
21 |
model.fit(X, y)
|
22 |
|
23 |
+
# Save the model
|
24 |
+
with open("lapse_model.pkl", "wb") as f:
|
25 |
+
pickle.dump(model, f)
|