Get Started with a Promote Model
This is a quick start guide to Alteryx Promote installation, configuration, and administration.
What is Promote?
Promote is a platform for deploying, managing, and scaling predictive models and advanced decision-making algorithms into production. The platform is designed for production-level use-cases and utilizes a distributed architecture to allocate and optimize requests to modes across the cluster.
Build a Model
R
The following sequence of commands is used to build a Promote model using R. For specifics regarding the methods available, see R Client.
- Import the Promote library.
library(promote)
- Define the model function.
model.predict <- function(request) {
me <- request$name
greeting <- paste0("Hello", me, "!")
greeting
}
- Specify your user name, apikey, and url.
promote.config <- c(
username = "colin",
apikey = "d325fc5bcb83fc197ee01edb58b4b396",
env = "https://promote.yourcompany.com"
)
- Deploy the model to the Promote platform.
promote.deploy("HelloWorld_PromoteTest", confirm = FALSE)
Executable example
library(promote)
model.predict <- function(request) {
me <- request$name
greeting <- paste0("Hello", me, "!")
greeting
}
promote.config <- c(
username = "colin",
apikey = "d325fc5bcb83fc197ee01edb58b4b396",
env = "https://promote.yourcompany.com"
)
promote.deploy("HelloWorld_PromoteTest", confirm = FALSE)
Python
The following sequence of commands is used to build a Promote model using python. For specifics regarding the methods available, see Python Client.
Deployment requirements
To deploy a python model, there must be a requirements.txt file in the same directory as the deployment script. It must contain at least the promote package.
- Import the Promote package.
import promote
- Define the model function.
def promoteModel(data):
return {'response': 'Hello ' + data['name'] + '!'}
- Execute the model locally with test data.
TESTDATA = {'name': 'Colin'}
promoteModel(TESTDATA)
# {'response': 'Hello Colin!'}
- Specify your username, apikey, and url.
USERNAME = 'your_username'
API_KEY = 'your_apikey'
PROMOTE_URL = "https://promote.yourcompany.com"
- Deploy the model to the Promote platform.
p = promote.Promote(USERNAME, API_KEY, PROMOTE_URL)
p.deploy("HelloModel", TESTDATA, verbose=2)
- Send a request to the model.
p.predict("HelloModel", {"name": "greg"})
# { 'result': {'response': 'Hello greg!'}},
# 'version': 1,
# 'promote_id': '9fbcb56a89bf318d8b50c41654554e3c',
# 'promote_model': 'HelloModel'}
Executable example
# import the promote package and define our model function
import promote
def promoteModel(data):
return {'response': 'Hello ' + data['name'] + '!'}
# execute locally with test data
TESTDATA = {'name': 'Colin'}
promoteModel(TESTDATA)
# {'response': 'Hello Colin!'}
# specify the username, apikey and url, and then deploy
USERNAME = 'your_username'
API_KEY = 'your_apikey'
PROMOTE_URL = "https://promote.yourcompany.com"
p = promote.Promote(USERNAME, API_KEY, PROMOTE_URL)
p.deploy("HelloModel", TESTDATA, verbose=2)
# Send a request to the model
p.predict("HelloModel", {"name": "greg"})
# { 'result': {'response': 'Hello greg!'}},
# 'version': 1,
# 'promote_id': '9fbcb56a89bf318d8b50c41654554e3c',
# 'promote_model': 'HelloModel'}
To access full executable file packages, see Python Example Models.
Designer
To build a model in Designer, use the R Suite tools to construct a workflow. The R Suite tools provide a variety of models that can be customized without using code. Once a model has been created:
- Use the Deploy tool to upload a model to the Promote server.
- Use the Score tool to make predictions.
Model Deployment
When a model is deployed, the code, dependencies, and any other relevant information is bundled and sent to the selected Promote instance.
New deployments trigger the creation of a docker image and container. Once the new version of a model can respond to API requests, the model's endpoint is updated to the latest version and any HTTP traffic is updated to the new route. With a zero-downtime switch, you will not experience any service interruption during a new deployment.