Generate a new prediction using an existing Analysis.
Resource URL
https://api.bigsquid.com/predictionapi/analyses/:id
POST Body
Fields
name | type | required | description |
---|---|---|---|
data | array of objects | Yes | An array of column names and values. The column schema must match the schema of the Analysis created within AutoML |
primaryKey | string | No | A column that acts as a primary key that can be used to link a single record back to the input data used in the request |
Sample Request - single prediction record
Content-Type: application/json
Accept: application/json
Authorization: token [API Key Here - without the brackets]
{
"primaryKey": "Account ID",
"data": [
{
"Account ID": "io97524",
"State": "KS",
"Customer Tenure": 110,
"Repeat Customer": "no",
"Promo Plan": "yes",
"Days to Sale": 25,
"Usage": 244.7,
"Prior Period Usage": 197.4,
"Base Fee": 45.07,
"Purchased Features": 16.78,
"Days Since Last Contact": 99,
"Customer Service Rank": 10,
"Customer Service Calls": 3,
"Taxes & Fees": 2.7,
"Nbr of Penalties": 1,
"Plan Type": "Monthly Auto-Renew"
}
]
}
Sample Response - single prediction record
Returns a predictions object with a predicted value, probabilities for the prediction if applicable, and the primary key if one was provided in the request.
HTTP/1.1 200 Success
Content-Type: application/json
{
"primaryKey": "Account ID",
"predictions": [
{
"Account ID": "io97524",
"prediction": "no",
"probability_no": 0.95755506,
"probability_yes": 0.04244495
}
]
}
Sample Request - multiple prediction records
Content-Type: application/json
Accept: application/json
Authorization: token [API Key Here - without the brackets]
{{
{
"primaryKey": "AccountID",
"data": [
{
"AccountID": "aa33376",
"State": "SC",
"Territory": "USA",
"SubscriberTenure": 110,
"MobilePlatform": "",
"Renewal": inputRenewal.value,
"Trial": "no",
"CurrentSessionTime": 241,
"PriorSessionTime": 221.2,
"SubscriptionFee": inputBaseFee.value,
"ActiveUsers": 19,
"AdditionalSites": 1,
"CustomerServiceRating": 12.5,
"SupportTickets": inputCSCalls.value,
"TotalUsers": 73,
"Subscription": "Red Plan"
},
{
"AccountID": "aa33376",
"State": "SC",
"Territory": "USA",
"SubscriberTenure": 110,
"MobilePlatform": "",
"Renewal": inputRenewal.value,
"Trial": "no",
"CurrentSessionTime": 241,
"PriorSessionTime": 221.2,
"SubscriptionFee": inputBaseFee.value,
"ActiveUsers": 19,
"AdditionalSites": 1,
"CustomerServiceRating": 12.5,
"SupportTickets": inputCSCalls.value,
"TotalUsers": 73,
"Subscription": "Blue Plan"
},
{
"AccountID": "aa33376",
"State": "SC",
"Territory": "USA",
"SubscriberTenure": 110,
"MobilePlatform": "",
"Renewal": inputRenewal.value,
"Trial": "no",
"CurrentSessionTime": 241,
"PriorSessionTime": 221.2,
"SubscriptionFee": inputBaseFee.value,
"ActiveUsers": 19,
"AdditionalSites": 1,
"CustomerServiceRating": 12.5,
"SupportTickets": inputCSCalls.value,
"TotalUsers": 73,
"Subscription": "Green Plan"
},
{
"AccountID": "aa33376",
"State": "SC",
"Territory": "USA",
"SubscriberTenure": 110,
"MobilePlatform": "",
"Renewal": inputRenewal.value,
"Trial": "no",
"CurrentSessionTime": 241,
"PriorSessionTime": 221.2,
"SubscriptionFee": inputBaseFee.value,
"ActiveUsers": 19,
"AdditionalSites": 1,
"CustomerServiceRating": 12.5,
"SupportTickets": inputCSCalls.value,
"TotalUsers": 73,
"Subscription": "Purple Plan"
}
]
}
}}
Sample Response - multiple prediction records
Returns a predictions object with predicted values, probabilities for the predictions if applicable, and the primary key if one was provided in the request.
HTTP/1.1 200 Success
Content-Type: application/json
{
"primaryKey": "AccountID",
"predictions": [
{
"AccountID": "aa33376",
"prediction": "yes",
"probability_no": 0.6398455501,
"probability_yes": 0.3601544499
},
{
"AccountID": "aa33376",
"prediction": "no",
"probability_no": 0.9608917236,
"probability_yes": 0.0391082764
},
{
"AccountID": "aa33376",
"prediction": "no",
"probability_no": 0.9834545851,
"probability_yes": 0.0165454
},
{
"AccountID": "aa33376",
"prediction": "no",
"probability_no": 0.9784049392,
"probability_yes": 0.0215950776
}
]
}