Adding predictive variables

Phân tích dự đoán nâng cao với Python

Nele Verbiest

Senior Data Scientist @PythonPredictions

Predictive variables

  • Demographics:
    • Age
    • Gender
    • Living place
  • Spending behaviour
  • Watching behaviour
  • Product usage
  • Surfing behaviour
  • Payment information
Phân tích dự đoán nâng cao với Python

Timeline compliant predictive variables (1)

Phân tích dự đoán nâng cao với Python

Timeline compliant predictive variables (2)

Phân tích dự đoán nâng cao với Python

Adding lifetime

# Reference date
reference_date = datetime.date(2018,4,1)

# Add lifetime to the basetable basetable["lifetime"] = reference_date - basetable["member_since"] print(basetable.head())
donor_id member_since lifetime
1        2015-02-03   1153
2        2016-01-30   729
3        2016-02-23   768
Phân tích dự đoán nâng cao với Python

Adding preferred contact channel (1)

donor_id start_valid_date end_valid_date  contact_channel
1        2014-02-03       2016-03-04      "phone"
1        2016-03-04       2016-05-08      "e-mail"
2        2016-02-23       2026-02-23      "e-mail"
reference_date = datetime.date(2018,4,1)

# Select lines compliant with reference data contact_channel_reference_date = living_places[ (contact_channel["start_valid_date"]<=reference_date) & (living_places["end_valid_date"]>reference_date)]
Phân tích dự đoán nâng cao với Python

Adding preferred contact channel (2)

# Add contact channel place to the basetable
basetable = 
    pd.merge(
     basetable, 
     living_places_reference_date[["donor_ID","contact_channel"]],
     on="donor_ID"
    )
print(basetable.head())
donor_id contact_channel
1        "phone"
2        "phone"
3        "e-mail"
Phân tích dự đoán nâng cao với Python

Let's practice!

Phân tích dự đoán nâng cao với Python

Preparing Video For Download...