How do I integrate MXO with External Propensity Models?
If you have existing AI models created in an external system, for example, R or Python, you can use these models in MXO by following the steps below to create a Datastore to hold your propensity scores. You can then make that data available to MXO for use in Priority Rules.
We've made the Datastores API publicly available on Github. You can find it here:
Step 1 - Request a Valid OAuth 2.0 token
Request a valid OAuth 2.0 token from MXO to use the Datastore API. Use your preferred API client to make the request, ensuring you provide the correct details.
You can use either the Client Credentials or Authorization Code grant type when requesting an OAuth Token for the Data Export API.
For more information, see:
Step 2 - Create a Datastore
Create a Datastore to hold the propensity scores you want to make available to MXO .
POST /datastores/1.0.0/MjIyOQ
{ "name": "Action Model", "apiName": "action_model", "primaryKey": "customerID", "secondaryKey": "propositionCode", "definitions": [{ "name": "customerID", "type": "TEXT" }, { "name": "propositionCode", "type": "TEXT" }, { "name": "propensity", "type": "NUMERIC" }] }
Step 3 - Create a Datastores Data Adapter
In MXO , create a Datastores Data Adapter that references the Datastore you set up in Step 2.
The propensities you make available in your Datastore are saved as attributes in the Datastores Data Adapter.
Step 4 - Populate your Datastore with propensity data
Populate your Datastore with the propensities from your model so that MXO can use them when ranking Actions. You can add the propensities bit-by-bit in staging before pushing the data to your live environment.
POST /datastores/1.0.0/MjIyOQ/action_model/staging
[{ "customerID": "CUST-LISA", "propositionCode": "credit", "propensity": 0.9 }, { "customerID": "CUST-LISA", "propositionCode": "mortgage", "propensity": 0.8 }, { "customerID": "CUST-LISA", "propositionCode": "invest", "propensity": 0.7 }, { "customerID": "CUST-NICK", "propositionCode": "credit", "propensity": 0.2 }, { "customerID": "CUST-NICK", "propositionCode": "mortgage", "propensity": 0.1 }, { "customerID": "CUST-NICK", "propositionCode": "invest", "propensity": 0.3 }]
Step 5 - Push staging data to your live environment
Before you can use your propensity model, you must push it to your live environment. This is a two-stage process:
- Get a reference to the staging data
- Use the reference to push the staging data to your live environment
Get a reference to the staging data
GET /datastores/1.0.0/MjIyOQ/action_model/staging/reference
{ "referenceId": "ds03573f2896ff45019d27482289537134" }
Use the reference to push the staging data to your live environment
POST /datastores/1.0.0/MjIyOQ/action_model/golive/ds03573f2896ff45019d27482289537134
Step 6 - Create an Eligibility Rule to link the Action to your model
Create an Eligibility Rule based on how your propensity model is set up.
If for example, your model gives propensities per product, create an Eligibility Rule to represent the Proposition code of the current Action:
Step 7 - Use propensity scores in a Priority Rule
After pushing your data live, you can use that data when creating a Priority Rule.
Reference the Eligibility Rule created in Step 6 to look up the correct propensity in the model, as follows.
Step 8 - Use your Priority Rule in an Optimization Point
After your Priority Rule has been created you can reference it in an Optimization Point and use your external model to rank the Actions presented.