modeldb icon indicating copy to clipboard operation
modeldb copied to clipboard

VR-7870 Support passing a dataframe in the client predict method

Open nhatsmrt opened this issue 4 years ago • 6 comments

I'm thinking of sth like this, in order to allow the user to define their model in terms of data frame (modulo some wrapper). Need to actually verify that it works 😬 But let me know if sth like this would be problematic, design-wise 🤔

nhatsmrt avatar Nov 18 '20 19:11 nhatsmrt

I think it would be important to maintain backwards compatibility (users who are passing a DataFrame to predict(), but are handling it as a plain array of values). @conradoverta What do you think?

convoliution avatar Nov 18 '20 19:11 convoliution

I think it would be important to maintain backwards compatibility (users who are passing a DataFrame to predict(), but are handling it as a plain array of values). @conradoverta What do you think?

We need to ship this asap. I'm ok breaking compatibility on this and adding a note.

conradoverta avatar Nov 18 '20 20:11 conradoverta

Make sure that we provide the conversion back too.

@conradoverta what do you mean by conversion back 🤔

nhatsmrt avatar Nov 18 '20 20:11 nhatsmrt

Make sure that we provide the conversion back too.

@conradoverta what do you mean by conversion back 🤔

How do I get my dataframe back inside my prediction model?

conradoverta avatar Nov 18 '20 20:11 conradoverta

Make sure that we provide the conversion back too.

@conradoverta what do you mean by conversion back 🤔

How do I get my dataframe back inside my prediction model?

@conradoverta I think what you meant is:

class MyModel(object):
  @prediction_input_df
  def predict(self, input):
    # input here should be a dataframe

right? It's handled by the prediction_input_df decorator, which, receiving the dictionary, will convert it back to a data frame and feed it to the predict method. This is analogous to other helper decorators that I found in DeployedModel.

nhatsmrt avatar Nov 18 '20 21:11 nhatsmrt

@conradoverta

Make sure that we provide the conversion back too.

@conradoverta what do you mean by conversion back 🤔

How do I get my dataframe back inside my prediction model?

Did Jim's reply address this?

convoliution avatar Nov 29 '20 21:11 convoliution

We're revisiting model I/O very, very soon. And that may come with changes in how the client handles predictions.

And I'm under the impression that users already find these sorts of decorators rather confusing 😬

liuverta avatar Sep 30 '22 19:09 liuverta