Custom Model Parser Service
This service is currently available to a limited set of clients.
The Custom Model Parser service lets you check the validity of decision trees written in our Bonsai Language (customer login required). You should use this service to identify and resolve any Bonsai syntax or feature errors before using the Custom Model Service to upload trees for use in campaigns.
This page walks you through the validation process. For background information on the purpose of custom models, see AppNexus Programmable Bidder (customer login required).
Step 1. Base64-encode your Bonsai decision tree
Once you have written your decision tree in our Bonsai Language, base64-encode it.
Step 2. Create a JSON file containing your encoded tree
Create a JSON file as shown below. The main object must contain a custom-model-parser
object with the encoded tree as a string in the model_text
field.
Step 3. POST
the file to the Custom Model Parser Service
Make a POST
call to the Custom Model Parser Service as shown below.
Step 4. Check the response
Tree is valid
If your Bonsai decision tree is valid, the custom-model-parser
object in the response will contain the following fields:
Field | Description |
---|---|
model_text | Your decision tree, in our internal Lisp storage format. |
size | The size of your decision tree, in bytes, in our internal Lisp storage format. Size Limit: The Lisp version of your tree must be smaller than 3 MB, or 3,145,728 bytes. If it is larger than that, you will not be able to add your tree using the Custom Model Service. |
Tree is not valid
If your Bonsai decision tree is not valid, the error
field in the response will identify the issue. An error can result from either invalid Bonsai syntax or invalid usage of Bonsai features. See Error Messages below for more details.
Error Messages
Syntax Errors
Illegal character found:
Second root node found:
Numeric operator used with non-numeric type:
Incorrect number of elements in a list (like having 3 elements in a range expression):
Feature Errors
There are two types of features: Features we validate against the DB, and features whose values must be certain numeric values. Validating against the DB, the error message seen for an invalid value is:
Validating numeric values, the error message seen for an invalid value is:
Features, descriptions, numeric restrictions are as follows:
country
: Country stringregion
: Region stringcity
: City stringsupply_type
: Supply typedomain
: URL stringbrowser
: Browser stringcarrier
: Carrier stringos_family
: OS family string
: Valid placement idplacement
size
: Size stringplacement_group
: Valid placement group idpublisher
: Valid publisher idmobile_app
: Valid mobile app idcookie_age
: Cookie age in daysuser_hour
: User hour must be between 0 and 23user_day
: User day must be between 0 and 6advertiser_life_freq
: Advertiser life frequency must be a positive integeradvertiser_day_freq
: Advertiser day frequency must be a positive integeradvertiser_recency
: Advertiser recency must be positive integer or -1device_type
: Device type stringestimated_iab_viewthrough_rate
: IAB viewthrough rate must be a number between 0 and 1
Related Topics
- AppNexus Programmable Bidder (customer login required)
- Custom Model Service
- Bonsai Features (customer login required)
- The Bonsai Language (customer login required)