alex-mon888
alex-mon888

Reputation: 51

Azure ML time series model inference error during data input (python)

In the Azure ML Studio I prepared a model with AutoML for time series forecasting. The data have some rare gaps in all data sets. I am using the following code to call for a deployed Azure AutoML model as a web service:

import requests
import json
import pandas as pd

# URL for the web service
scoring_uri = 'http://xxxxxx-xxxxxx-xxxxx-xxxx.xxxxx.azurecontainer.io/score'
    
# Two sets of data to score, so we get two results back
new_data = pd.DataFrame([
            ['2020-10-04 19:30:00',1.29281,1.29334,1.29334,1.29334,1],
            ['2020-10-04 19:45:00',1.29334,1.29294,1.29294,1.29294,1],
            ['2020-10-04 21:00:00',1.29294,1.29217,1.29334,1.29163,34],
            ['2020-10-04 21:15:00',1.29217,1.29257,1.29301,1.29115,195]],
            columns=['1','2','3','4','5','6']        
)
# Convert to JSON string
input_data = json.dumps({'data': new_data.to_dict(orient='records')})

# Set the content type
headers = {'Content-Type': 'application/json'}
    
# Make the request and display the response
resp = requests.post(scoring_uri, input_data, headers=headers)
print(resp.text)

I am getting an error:

{\"error\": \"DataException:\\n\\tMessage: No y values were provided. We expected non-null target values as prediction context because there is a gap between train and test and the forecaster depends on previous values of target. If it is expected, please run forecast() with ignore_data_errors=True. In this case the values in the gap will be imputed.\\n\\tInnerException: None\\n\\tErrorResponse \\n{\\n

I tried to add "ignore_data_errors=True" to different parts of the code without a success, hence, getting another error:

TypeError: __init__() got an unexpected keyword argument 'ignore_data_errors'

I would very much appreciate any help as I am stuck at this.

Upvotes: 1

Views: 448

Answers (1)

alex-mon888
alex-mon888

Reputation: 51

To avoid getting the provided error in time series forecasting, you should enable Autodetect for the Forecast Horizon. It means that only ideal time series data can use manually set feature which is not helping for real-world cases. see the image

Upvotes: 1

Related Questions