You
can run your custom artificial intelligence (AI) and machine learning (ML) models
externally in third-party machine learning services. This way, you
can implement custom predictive models in your decision strategies by connecting to
models in the Google AI Platform and Amazon SageMaker machine learning
services.
For
a list of Amazon SageMaker models that are supported in
Pega Platform,
see
Supported Amazon SageMaker models.
Before you begin: Define your model, and the machine learning service
connection:
- In a third-party cloud ML service of your choice, create an ML model.
- In Dev Studio, connect to your cloud service instance
by creating an authentication profile.
- For a Google AI Platform service connection, create an OAuth 2.0
authentication profile.
- For an Amazon SageMaker service connection, create an Amazon Web
Services (AWS) authentication profile.
For more information, see
Creating an authentication profile.
- In Prediction Studio, define your ML service.
For more
information, see Configuring a machine learning service connection.
-
In the navigation pane of Prediction Studio, click Models.
-
In the header of the Models work area,
click .
-
In the New predictive model dialog box, enter a
Name for your model.
-
In the Create model section, click Select
external model.
-
In the Machine learning service list, select the ML
service from which you want to run the model.
Pega Platform
currently
supports Google AI Platform and Amazon SageMaker
models.
-
In the Model list, select the model that you want to
run.
The list contains all the models that are part of the authentication profile
that is mapped to the selected service.
-
In the Upload model metadata section, upload the model
metadata file with input mapping and outcome categories for the model:
-
Download the template for the model metadata file in JSON format by
clicking Download template.
-
On your device, open the template model metadata file that you
downloaded and define the mapping of input fields to Pega Platform.
For example: To predict if a customer is likely to churn, define the mapping of
input fields as
follows:
{
"predictMethodUsesNameValuePair": false,
"predictorList": [{
"name": "GENDER",
"type": "CATEGORICAL"
},
{
"name": "AGE",
"type": "NUMERIC"
}
],
"model": {
"objective": "Churn",
"outcomeType": "BINARY",
"expectedPerformance": 70,
"framework": "SCIKIT_LEARN",
"modelingTechnique":"Tree model",
"outcomes": {
"range": [
],
"values": [
"yes", "no"
]
}
}
}
-
Save the model metadata file.
-
In Prediction Studio, click Choose
file, and then double-click the model metadata
file.
-
In the Context section, specify where you want to save the
model:
-
In the Apply to field, press the Down arrow key,
and then click the class in which you want to save the model.
-
Define the class context by selecting the appropriate values in the
Development branch, Add to
ruleset, and Ruleset version
lists.
-
Verify the settings, and then click Next.
-
In the Outcome definition section, define what you want
the model to predict.
Enter a meaningful value, for example, Customer Churn
.
Note: To capture responses for the model, the model objective label that you
specify should match the value of the .pyPrediction
parameter in the response strategy (applies to all model types).
-
In the Predicting list, select the model type:
- For
binary outcome models, select Two categories, and
then specify the categories that you want to predict.
Binary outcome
models are models for which the predicted outcome is one of two possible
outcome categories, for example, Churn or
Loyal.
- For categorical outcome models, select More than two
categories, and then specify the categories that you want to
predict.
Categorical outcome models are models for which the predicted
outcome is one of more than two possible outcome categories, for
example, Red,
Green, or
Blue.
- For continuous outcome models, select A continuous
value, and then enter the value range that you want to
predict.
Continuous outcome models are models for
which the predicted outcome is a value between a minimum and maximum
value, for example, between 1 and
99.
-
In the Expected performance field, enter a value that
represents the expected predictive performance of the model:
- For binary models, enter an expected area under the curve (AUC) value
between 50 and 100.
- For categorical models, enter an expected F-score performance value
between 0 and 100.
- For continuous models, enter an expected RMSE value between 0 and
100.
-
Review the model settings, and then click Create.
Result: Your custom model is now available in Prediction Studio.
-
Click Save.
What to do next: Include your model in a strategy. For more information
about strategies, see About Strategy rules.