ibm-early-programs / node-red-contrib-watson-machine-learning

Apache License 2.0
2 stars 9 forks source link

Pb with Node 'wml' predictions : compatible with Spark models? #8

Closed bmarolleau closed 6 years ago

bmarolleau commented 6 years ago

Hi , I'm getting an error when trying to use the wml node with a spark model requiring a payload like msg.payload = {"fields": ["AGE", "GENDER_index", "MARITAL_STATUS_index", "PROFESSION_index"], "values": [[27,0,1,1]]};
as specified in the WML API Swagger http://watson-ml-api.mybluemix.net

This works of course in my js sample code, but not with the wml node, (getting the "An array of values is required on msg.payload to run a prediction" error message) as the current version checks if the payload is an array.
Am I doing it wrong? or potential node enhancement ?

Thx , keep up the good work!!

chughts commented 6 years ago

The node was actually only expecting an array of values. eg

msg.payload = [[27,0,1,1]];

but the node has been updated to allow

msg.payload = {"fields": ["AGE", "GENDER_index", "MARITAL_STATUS_index", "PROFESSION_index"], "values": [[27,0,1,1]]};

you will need to upgrade to version 0.0.5 of the node.

bmarolleau commented 6 years ago

Hi, Thank you very much, it works like a charm with my spark model now !!

image