google-cloud-ml - "error": "Prediction failed: unknown error."

标签 google-cloud-ml

我请求对经过训练的模型(使用线性学习算法创建的模型)进行在线预测,并收到“错误”:“预测失败:未知错误。”

这是我在 Google AI 平台中的第一个机器学习模型。模型训练成功,训练数据、验证数据和测试数据在输出文件夹中看起来都很好。但是当我尝试通过传递输入 JSON 来测试模型时,出现此错误。我寻找过类似的其他帖子,但找不到成功预测的解决方案。

工件文件夹中的metadata.json 看起来像

{
    "feature_columns": {
    "col_0": {
      "mapping": {
        "0": 0, 
        "1": 1, 
        "10": 10, 
        "2": 2, 
        "3": 3, 
        "4": 4, 
        "5": 5, 
        "6": 6, 
        "7": 7, 
        "8": 8, 
        "9": 9
      }, 
      "mode": "0", 
      "num_category": 11, 
      "treatment": "identity", 
      "type": "categorical"
    }, 
    "col_1": {
      "mapping": {
        "0": 0, 
        "1": 1, 
        "10": 10, 
        "2": 2, 
        "3": 3, 
        "4": 4, 
        "5": 5, 
        "6": 6, 
        "7": 7, 
        "8": 8, 
        "9": 9
      }, 
      "mode": "4", 
      "num_category": 11, 
      "treatment": "identity", 
      "type": "categorical"
    }
  }, 
  "target_algorithm": "TensorFlow", 
  "target_column": {
    "type": "regression"
  }
}

我传递用于测试预测的输入 JSON 是 {“实例”:[5,5]}

模型预计将对 2 个输入特征求和并给出结果 10

请您指出错误在哪里?

最佳答案

如果您使用 gcloud 发送文件,请执行以下操作:

 {"col_0": "5", "col_1": "5" }

如果您通过其他客户端发送一堆实例,请执行以下操作:

{ 
  "instances": [
    {"col_0": "5", "col_1": "5" },
    {"col_0": "3", "col_1": "2" }
  ]
} 

关于google-cloud-ml - "error": "Prediction failed: unknown error.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57874778/

相关文章:

python - gcloud ml-engine 在大文件上返回错误

python - 将基本 Tensorflow 模型导出到 Google Cloud ML

python - 如何从自定义人工智能平台模型登录

python - 创建版本失败。检测到错误模型,错误为 : "... No module named ' sklearn. impute._base'; 'sklearn.impute' 不是一个包。 (错误代码:0)”

python-3.x - 语法错误 : invalid syntax while running Job

google-cloud-ml - cloud ml 预测 FAILED_PRECONDITION 和字段 [projectsId] 的值

python - 了解 google ai 平台自定义预测例程的输入

python - 谷歌云AI平台执行作业时出错

machine-learning - GPU 在参数服务器上进行数据并行训练是否高效?

python - Google Cloud AI Platform 在线预测请求中是否可以指定服务默认值以外的签名?