您在此处:
在 REST API 中获取预测
使用 Salesforce Data 360 Connect REST API,以编程方式与预测模型交互。使用预测端点获取预测、热门因素和处方。
POST 请求正文
在您运行预测时,Salesforce 会将模型应用于模型输入集,并为指定的每组输入值返回预测分数。例如,如果您指定了三组值,您将按请求中指定记录的顺序获得三个预测。
GET /services/data/v61.0/ssot/machine-learning/configured-models/{ModelIdOrName}让我们使用“预测的购买”模型来查看 REST 请求。
{
"model":
{
"name": "Predicted_Purchased_CM_12l_YSs01128465"
},
"type": "RawData",
"fieldNames": ["Industry_c__c", "Response_Time_From_Assignment_c__c" , "Company_c__c", "Title_c__c"],
"rows":
[
["High Tech", 56, "Condax","Student"],
["Professional Services",70,"Rantouch","Developer"]
],
"settings" : {
"maxPrescriptions" : 3,
"maxTopFactors" : 2,
"prescriptionImpactPercentage" : 50
}
}maxPrescriptions指定响应中返回的最大改进数量 (1-3)maxTopFactors指定响应中返回的热门预测因素的数量 (1-3)prescriptionImpactPercentage指定在响应中返回改进所需的阈值筛选器(结果的最低改进百分比,在本例中为 50%)
POST 响应
POST 响应示例。
{
"aggregatePredictions": [],
"model": {
"id": "12l1Q000000blV0QAI"//Id
},
"predictionType": "BinaryClassification",
"predictions": [
{
"factors": [
{
"fields": [
{
"customText": null,
"inputValue": "Student",
"label": null,
"name": "Title_c__c",
"prescribedValue": "Title"
}
],
"value": -40.58208510642879
},
{
"fields": [
{
"customText": null,
"inputValue": "56",
"label": null,
"name": "Response_Time_From_Assignment_c__c",
"prescribedValue": "Response Time From Assignment"
}
],
"value": 10.187649697792125
}
],
"partition": {
"id": "12l1Q000000blV0QAI" //Id"
},
"predictedValue": 0.5997765233332488,
"prescriptions": [],
"status": "Success",
"type": "BinaryClassification",
"warnings": {
"missingFieldNames": [],
"outOfBoundsFields": []
}
},
{
"factors": [
{
"fields": [
{
"customText": null,
"inputValue": "Developer",
"label": null,
"name": "Title_c__c",
"prescribedValue": "Title"
}
],
"value": -28.000138322513255
},
{
"fields": [
{
"customText": null,
"inputValue": "70",
"label": null,
"name": "Response_Time_From_Assignment_c__c",
"prescribedValue": "Response Time From Assignment"
}
],
"value": 6.156639498073147
}
],
"partition": {
"id": "12l1Q000000blV0QAI" //Id"
},
"predictedValue": 5.278021902657085,
"prescriptions": [],
"status": "Success",
"type": "BinaryClassification",
"warnings": {
"missingFieldNames": [],
"outOfBoundsFields": []
}
}
],
"settings": {
"aggregateFunctions": [],
"maxPrescriptions": 3,
"maxTopFactors": 2,
"prescriptionImpactPercentage": 50
}
}
