Passing data frame to MS R Server model operationalisation

不想你离开。 提交于 2020-01-25 07:19:07

问题


I am running ML server and I have a service deployed that expects one of its inputs to be a data.frame.

When I connect with R to that API endpoint using mrsdeploy, I am able to pass a data.frame. I would like to do the same in prostman using json.

How can I format my json for lets say an input (data.frame) of characteristics about someone?

I would assume its something like { ... "bio": { "age" : 23, "height" : 12, "eyeC" : "red" } }

I have tried a variety of combinations all getting back an error about converting to data.frame in R


回答1:


You have to pass the data frame in column format, not rows. Ie, if your data looks like this:

foo bar
  1   a
  2   b
  3   c

Then the API expects the input to be

{
  "foo": [1, 2, 3],
  "bar": ["a", "b", "c"]
} 



回答2:


So when deploying a service, there should be a Swagger definition created for that service. Cannot you import that definition into Postman, and go from there?

Read here for more information.



来源:https://stackoverflow.com/questions/52544689/passing-data-frame-to-ms-r-server-model-operationalisation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!