繁体   English   中英

Automl SDK 代码,文件位置来自 bigquery,但在预测时有问题

[英]Automl SDK code with file location from bigquery but having issue while predicting

我在 AI Platform 中使用 GCP automl sdk 模块创建了一个 model(使用 bigquery 表作为训练和预测的输入)并使用 batch_prediction 进行预测。 问题是代码运行正常,但 output 预测表为空,错误表包含来自预测 dataframe 的所有系列,附加列显示错误代码 3,错误是“时间序列没有可预测的值。时间序列已被排除在预测之外”。

我用于 model 培训的代码:

job = aiplatform.AutoMLForecastingTrainingJob(
    display_name='train-sdk-automl_tst1',
    optimization_objective='minimize-mae',    
    column_transformations=[
        {"timestamp": {"column_name": "Date"}},
        {"numeric": {"column_name": "Price"}},
        {"numeric": {"column_name": "Grammage"}},
        {"numeric": {"column_name": "apparentTemperatureMax"}},
        {"numeric": {"column_name": "apparentTemperatureMin"}},
        {"numeric": {"column_name": "Consumer_promo"}},
        {"numeric": {"column_name": "Promo_Value"}},
        {"numeric": {"column_name": "Trade_Promotion"}},
        {"numeric": {"column_name": "Holiday"}},
        {"numeric": {"column_name": "Sales"}},
    ]
)

# This will take around an hour to run
my_model = job.run(
    dataset=ds,
    target_column='Sales',
    time_column='Date',
    time_series_identifier_column='SKU',
    available_at_forecast_columns=['Date', 'Price','Grammage'
                                   ,'apparentTemperatureMax','apparentTemperatureMin','Consumer_promo',
                                   "Promo_Value","Trade_Promotion","Holiday"],
    unavailable_at_forecast_columns=['Sales'],
    forecast_horizon=21.0,
    data_granularity_unit='week',
    data_granularity_count=1,
    weight_column=None,
    budget_milli_node_hours=1000,
    model_display_name='sdk_tsting_bq-forecast-model', 
    predefined_split_column_name=None
)

预测代码:

BATCH_PREDICT_SOURCE = 'bq://acn-intelligent-supply-chain.scoa_ml_forecast_tool.test_data_sdk1'
BATCH_PREDICT_DESTINATION_PREFIX = 'bq://acn-intelligent-supply-chain.scoa_ml_forecast_tool' 
my_model.batch_predict(
   bigquery_source=BATCH_PREDICT_SOURCE,
   instances_format='bigquery',
   bigquery_destination_prefix = BATCH_PREDICT_DESTINATION_PREFIX,
   predictions_format='bigquery',
   job_display_name='predict_sdk_tst')

请建议这里可能出了什么问题。

我相信用于批量预测的 BQ 表需要在目标(例如“销售”)列中有 NULL 个值。 如果您还没有这样做,请尝试一下,看看是否有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM