I followed a sample notebook to create a IBM cloud machine learning model using scikit-learn
. The tutorial can be found here.
Every cell runs correctly and the model is deployed successfully, but when I click into the model and try to make a prediction, an error “Invalid input data” shows up. Why does this issue occur and how should I solve this?
wml_credentials = {
"username": "****",
"password": "****",
"instance_id": "****",
"url": "https://ibm-watson-ml.mybluemix.net”
}
When creating the API client, I tried changing the url
from "https://ibm-watson-ml.mybluemix.net”
to "https://us-south.ml.cloud.ibm.com”
.
I also tried adding the access key like:
wml_credentials = {
"access_key”: "****",
"username": "****",
"password": "****",
"instance_id": "****",
"url": "https://ibm-watson-ml.mybluemix.net”
}
Nothing helped.
Instead of passing individual values for f0,f1,f2..... You can pass the input as JSON shown below
{
"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 ] ]
}
Attaching is a screenshot on how to pass JSON input under deployment
I just verified the notebook and you don't have to change the ML URL.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments