What should be the format for input-data while Testing the endpoints of deployed Prophet Time-series model in Azure-ML?

SP 5 Reputation points
2023-03-23T04:00:37.8066667+00:00

I have trained and deployed a FbProphet Time-series model using Mlflow in the Azure-ML . The model was properly registered and logged with all the required entities. I was able to deploy the model in Azure-ML and generate the endpoints.

My training Dataframe (which i used for training the Prophet mode) looks like :


df =  pd.DataFrame({'ds': ['2023-01-01 00:00:00', '2023-01-01 01:00:00', '2023-01-01 02:00:00', '2023-01-01 03:00:00'],
            'y': [20, 21, 19, 18]})

Now I want to test those endpoints. Under the testing-section, I see error while trying to give input. The interface for taking input looks like :

{
  "input_data" : 
}

I am unable to figure out,

exactly what data (please provide example) and in which format should be entered here to test my time-series prophet model.?

P.S. - I know that for prediction prophet takes Dataframe (which contains dates in the column named as 'ds') as an input to predict the future values. But in the Azure-testing interface there is no provision to enter a Dataframe (or if there, i do not know how to do it).

Also even for utilizing the end-points in the code I need to know the type and format of input_data required for consumption of end-points.

I have tried many combinations and every time I am getting error.

for e.g.

  1. using json on the data

json.dumps({'data': df.to_dict(orient='records')})

and feeding the its output here as :

{
      "input_data":[{"ds": "2021-01-01 00:00:00", "y": 23.55}, {"ds": "2021-01-01 01:00:00", "y": 26.28}]
    }

Error - Failed to test real-time endpoint {"message":"only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices"}

2- trying other combinations

{
  "input_data" :{"ds":{"1":"2023-04-01 22:00:00", "2": "2023-04-01 23:00:00"}
}

Error: Failed to test real-time endpoint {"message":"POST body could not be decoded as JSON: Expecting ',' delimiter: line 3 column 2 (char 81)"}

3- feeding only dates

{
  "input_data" :["2023-04-01 22:00:00","2023-04-01 23:00:00"]
}

then

{

"input_data" :[[1,2], ["2023-04-01 22:00:00","2023-04-01 23:00:00"]]

}

Error : Failed to test real-time endpoint {"message":"only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices"}

And likewise, i tried many more ways. But not able to figure out my mistake. Please help me, what i am missing-out ? I am new to deploying a Time-Series model.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,332 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Shohei Nagata 0 Reputation points
    2023-05-16T01:30:23.9666667+00:00

    We need to authenticate to the online endpoint to open the Swagger URL.

    I know the following page doesn't show the exact way to get the Swagger but it can be helpful to understand the authentication.

    https://learn.microsoft.com/en-us/azure/machine-learning/how-to-authenticate-online-endpoint?view=azureml-api-2&tabs=azure-cli

    Also, using the AzureML inference HTTP server locally will help us understand the behavior of the server used in online endpoints.
    https://learn.microsoft.com/en-us/azure/machine-learning/how-to-inference-server-http?view=azureml-api-2


  2. Manoj Kaleeshvaran 0 Reputation points
    2025-06-09T13:46:26.36+00:00

    I also have been through this error.
    Simple thing - This error happens when you try to access endpoint through browser

    Two main things:

    • Azure endpoints expect the bearer token or Azure idenity
    • Web browsers use GET method when you enter an URL but Azure endpoint expects POST method with JSON having input data

    So that Endpoints could not be accessed through browser.

    Instead Use Python or CMD to get results, in python Before that you should have a primary key for auth purpose

    az ml online-endpoint get-credentials --name <Your_endpoint_name> --resource-group <your_rg_name> --workspace-name <Your_workspace_name>
    

    use primary key you got from the above

    import requests
    
    headers = {
        "Authorization": "Bearer <YOUR_PRIMARY_KEY>",
        "Content-Type": "application/json"
    }
    data = {
        "input_data": [[input data value]] # e.g [[4,115,50,29,243,34.69215364,0.741159926,59]]
    }
    
    response = requests.post("<Your Endpoint url>", headers=headers, json=data)
    print(response.json())
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.