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


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?

enter image description here

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.

Vidyasagar Machupalli

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

enter image description here

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.

edited at


Login to comment


Why when i try push my Spring boot app to heroku it return "Fatal error compiling: invalid target release: 11"

JMeter: Why get error when try to save test plan

Why do I get an "invalid values" error when I try to access the network settings on Eclipse Mars?

Why I get error when I try to create stored procedure?

I keep getting the following error when I try to take in user input - ValueError: invalid literal for int() with base 10: ''

I get Invalid argument error when try to addRule to stylesheet in ie

How can I solve the 'could not convert string to float:' error when I try to embed sequence data in a keras model

Why is Google Cloud Functions throwing a "Invalid value for config firebase.databaseURL" error when I try to initialize a firebase app?

Why is Cosmos DB giving me an "The input name '{' is invalid" error when I call CreateItemAsync

"amount is invalid" error when i try to withdraw in Bitmex (ccxt)

Why I am getting an error when i try to save form into quiz model with entity framework?

DeepLearning: Got error when try to import one test data into model

error when I try to fill table with data

Why do I get this error in my logcat when I try to post JSON data?

Make file error when I try to do with linking the test file

Why do I get a type error in model.predictOnValues when I try the official example of Streaming Kmeans Clustering of Apache Spark?

Why is the Visual Studio 2013 debugger closing without error when I try to expand Model properties?

Why are no parameters passed in when I try to test my API with Postman?

Mean stack deployed successfully on heroku but I get Application Error

Uncaught SyntaxError: Unexpected end of JSON input error when i try to take data from mysql

Error on jest when I try to run the test

Django error:name '_' is not defined,when I try to create a new model

Why do I get a NoClassDefFound error when I try to save my test plan?

When I try to download StanfordNLP en model, it gives an error

Gcc throws error when I try to compile the test folder in libburn

Why do I get an error when I try to save mongoose model?

Application Error on Heroku but model successfully deployed

Python/Terminal - Why am I getting this error message when I try to get user input

Why my data get undefined when I successfully get the response?

TOP Ranking