【发布时间】:2020-12-31 17:00:07
【问题描述】:
我可以使用 gcloud 生成本地预测,但不能生成 XGBoost 模型的在线预测。在线预测没有错误信息,只是一个空响应
本地预测 -
输入json - [40, 1, 0, 20, 3, 2020, 4, 0, 0, 0, 2, 0, 5, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]
gcloud-
gcloud ai-platform local predict --model-dir <model_dir> --json-instances <input_json> --framework xgboost
输出 -
INFO: Display format: "default table[no-heading](predictions)"
[0.3261602520942688]
当我使用相同的 json 生成在线预测时
在线预测
gcloud -
gcloud ai-platform predict --model $MODEL_NAME --version $VERSION_NAME --json-instances test_json_modified.json
输出 -
INFO: Display format: "default table[no-heading](predictions)"
[[]]
我尝试使用 GUI 生成在线预测,但仍然无法获得任何结果 -
我尝试过使用不同的输入 json 格式,如下所示,但没有任何效果 -
{"instances": [{"values": [[40, 1, 0, 20, 3, 2020, 4, 0, 0, 0, 2, 0, 5, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]], "key": 1}]}
【问题讨论】:
标签: python machine-learning xgboost google-cloud-ml google-ai-platform