JSON response structures for various models
Binary classification, Regression, Multiclass classification
The following models have similar JSON structure: Binary classification, Logistic regression, Multiclass classification
The JSON structure consists of a root object with a key-value pair, where the key is "data" and the value is an object containing two keys: "columns" and "data".
"data"
: This key maps to an array of data objects. Each data object within the array represents a specific entry or prediction result. In this example, there are two data objects.
Each data object contains key-value pairs representing the column names and their corresponding values. For example, the first data object has the values "NO", "API", "bing", 0.935, 0.065, and "1" for the keys "Label", "Lead Origin", "Lead Source", "Score_NO", "Score_YES", and "Total Time Spent on Website", respectively.
The second data object follows a similar pattern, with different values for each key.
"columns"
: This key maps to an array of column names. In this example, the array contains three column names: "Total Time Spent on Website", "Lead Origin", and "Lead Source". These column names define the fields or attributes associated with each data entry.
Timeseries model
The JSON structure consists of a root object with a key-value pair, where the key is "data" and the value is an array. The array contains three elements representing different pieces of information. Last element in data array(sequenceID) is directly related to "sequenceID" sent in request, and the number of other elements depends on date difference sent in request.
"date"
and "predicted"
: The first two elements within the "data" array represent specific dates and their corresponding predicted values. Each element is an object with two key-value pairs: "date" and "predicted". The "date" represents a specific date and time in ISO 8601 format, and the "predicted" holds the corresponding predicted value for that date. In the given example, the predicted values for the dates "2023-04-17T00:00:00.000Z" and "2023-04-18T00:00:00.000Z" are 40.4385672276 and 41.1831442568, respectively.
"sequenceID"
: The third element within the "data" array represents the sequence ID. It is an object with a single key-value pair: "sequenceID" and its corresponding value. In this example, the sequence ID is represented as "A". If your dataset includes multiple time series sequences, you should choose a field that uniquely identifies each sequence (e.g., product ID, store ID, etc.). This will allow Graphite Note to generate independent forecasts for each individual time series. We don't allow fields with too many sequences (unique values) here.
This JSON structure is used to convey the predicted values for different dates in a Tmeseries model. Each date is associated with its predicted value, and the sequence ID provides additional context or identification for the timeseries data.
Receiving a response
Upon successful execution of the API request, you will receive a response containing the prediction results or any relevant information based on the model and data provided. The format and structure of the response will vary depending on the specific model and endpoint used.
This is a Timeseries period prediction example:
The response contains a single key-value pair:
"data"
: The key "data"
maps to an array of objects that represents the prediction results or relevant information.
Make sure to handle the response appropriately in your code to process the prediction results or handle any potential errors returned by the API. More about structure on next section.