Response Structure

JSON response structures for various models

Binary classification, Regression, Multiclass classification

The following models have similar JSON structure: Binary classification, Logistic regression, Multiclass classification

{
    "data": {
        "columns": [
            "Total Time Spent on Website",
            "Lead Origin",
            "Lead Source"
        ],
        "data": [
            {
                "Label": "NO",
                "Lead Origin": "API",
                "Lead Source": "bing",
                "Score_NO": 0.935,
                "Score_YES": 0.065,
                "Total Time Spent on Website": "1"
            },
            {
                "Label": "NO",
                "Lead Origin": "Lead Import",
                "Lead Source": "bing",
                "Score_NO": 0.8955,
                "Score_YES": 0.1045,
                "Total Time Spent on Website": "153"
            }
        ]
    }
}

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".

  1. "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.

A "Score_NO": 0.8955 means 89.55% probability that the prediction is "NO."
At the same time, "Score_YES": 0.1045 means 10.45% probability that the prediction is "YES".
  1. "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

{
    "data": [
        {
            "date": "2023-04-17T00:00:00.000Z",
            "predicted": 40.4385672276
        },
        {
            "date": "2023-04-18T00:00:00.000Z",
            "predicted": 41.1831442568
        },
        {
            "sequenceID": "A"
        }
    ]
}

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.

  1. "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.

  2. "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.

Last updated