In [2]:
import re
model= """
if segment[1].age <= 180:
1
else:
5
"""
# Needed if from a notebook
model_str = "\n".join([re.sub("(\s{4})", "\t", line) for line in model.split('\n')])
model_name = "test_bonsai_1"
member_id = int('your_member_id')
bonsai_api = BonsaiAPI(**APPNEXUS_ACCOUNT)
In [14]:
bonsai_api.add_model(model_name=model_name,
member_id=member_id, advertiser_id=int('your_advertiser_id'),
model_output="bid_modifier", model_str=model_str)
In [15]:
[x for x in bonsai_api.get_models() if x['name'] == model_name]
Out[15]:
In [ ]: