Hello,
I am developing a model and hosting it in Docker as a REST-API with Plumber. Let's say the function is calculate_prediction(x1, x2...) and it returns a probability y.
However, I had a discussion with the team on how to send the parameters to the function and we are stuck between two alternatives:
-
Send all the parameters directly into the function using JSON or query string, such that the function will be calculate_prediction(x1, x2..., xn), where x is all the explanatory variables needed in the model.
-
Send only the customer ID as the parameter, and have the function pick up the data itself - so the Plumber function would be called as calculate_prediction(id), and then inside the function it collects the data for that id from the database and returns the prediction.
Those who do not like option 1) claim that it is very "inefficient" to send large amount of data this way (currently there are 20 variables but that could increase), but I don't quite understand why.
Does anyone have an idea what is considered "best practice" here?