I am working on churn prediction. The observation and performance windows are sliced as below:
# use user last n.th mounth and create userpofile from this
# |## observed period - user profile # |##perdict period-chur or not###|
# |<- number_of_months ->|<- predict_period_months ->|
For concrete situation the windows are:
number_of_months=18
predict_period_months=4
def last_nth_month(x):
min_date = x['MONTH_ID'].max()-pd.DateOffset(months=(number_of_months+predict_period_months))
max_date = x['MONTH_ID'].max()-pd.DateOffset(months=predict_period_months)
return x.loc[(x['MONTH_ID']< max_date) & (x['MONTH_ID']>min_date),:]
The user profile is based on 18 month of behaviour in past and 4 last months didn't use for training and testing.
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42, stratify=y)
As a results I got pretty good scores using Lightgbm:
precision recall f1-score support
0 0.91 0.95 0.93 49092
1 0.95 0.91 0.93 49092
accuracy 0.93 98184
macro avg 0.93 0.93 0.93 98184 weighted avg 0.93 0.93 0.93 98184
Accuracy = 0.9309256090605394
Is there any suggestion about how to use information in the period of the last 4 months for the testing trained model?