当我尝试测试已成功部署的 ML 模型时,为什么会出现“无效数据输入”错误?

Why is there an error “invalid data input” when I try to test a successfully deployed ML model?

我按照示例笔记本使用 scikit-learn 创建了 IBM 云机器学习模型。教程can be found here.

每个单元都运行正确并且模型部署成功,但是当我点击进入模型并尝试进行预测时,出现错误“输入数据无效”。为什么会出现这个问题,我该如何解决?

wml_credentials = {
  "username": "****",
  "password": "****",
  "instance_id": "****",
  "url": "https://ibm-watson-ml.mybluemix.net”
}

在创建 API 客户端时,我尝试将 url"https://ibm-watson-ml.mybluemix.net” 更改为 "https://us-south.ml.cloud.ibm.com”

我还尝试添加访问密钥,例如:

wml_credentials = {
  "access_key”: "****",
  "username": "****",
  "password": "****",
  "instance_id": "****",
  "url": "https://ibm-watson-ml.mybluemix.net”
}

没有任何帮助。

而不是传递 f0、f1、f2 的单个值......您可以将输入传递为 JSON,如下所示

{
  "fields" : [ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39", "f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47", "f48", "f49", "f50", "f51", "f52", "f53", "f54", "f55", "f56", "f57", "f58", "f59", "f60", "f61", "f62", "f63" ],
  "values" : [ [ 0.0, 5.0, 12.0, 13.0, 16.0, 16.0, 2.0, 0.0, 0.0, 11.0, 16.0, 15.0, 8.0, 4.0, 0.0, 0.0, 0.0, 8.0, 14.0, 11.0, 1.0, 0.0, 0.0, 0.0, 0.0, 8.0, 16.0, 16.0, 14.0, 0.0, 0.0, 0.0, 0.0, 1.0, 6.0, 6.0, 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 16.0, 3.0, 0.0, 0.0, 0.0, 1.0, 5.0, 15.0, 13.0, 0.0, 0.0, 0.0, 0.0, 4.0, 15.0, 16.0, 2.0, 0.0, 0.0, 0.0 ] ]
}

附件是如何在部署

下传递JSON输入的截图

我刚刚验证了笔记本,您不必更改 ML URL。