1

在 Azure ML Studio 中,我使用 AutoML 准备了一个用于时间序列预测的模型。这些数据在所有数据集中都有一些罕见的差距。我正在使用以下代码将已部署的 Azure AutoML 模型调用为 Web 服务:

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)

我收到一个错误:

{\"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

我试图将“ignore_data_errors=True”添加到代码的不同部分但没有成功,因此出现另一个错误:

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

我非常感谢任何帮助,因为我陷入了困境。

4

1 回答 1

1

为避免在时间序列预测中出现提供的错误,您应该为预测范围启用自动检测。这意味着只有理想的时间序列数据才能使用手动设置的功能,这对实际情况没有帮助。 看图片

于 2021-01-12T22:36:00.113 回答