Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predict in Datapoint-Editor leads to non-deterministic behavior #237

Open
LinusEdelkott opened this issue Jun 13, 2024 · 1 comment
Open

Comments

@LinusEdelkott
Copy link

LinusEdelkott commented Jun 13, 2024

I stumled upon the quite annoying issue, that predicting via the data-point editor returns non-deterministic results.

I created the widget with a custom_predict_function as there's a sklearn-pipeline around my xgbm model. The creation of the widget works fine, but if I change one datapoint in the widgets editor and click on predict and change it back, it results in seemingly random results.

def custom_predict_processed(examples_to_infer):
  model_ins = pd.DataFrame(examples_to_infer)
  preds = model[1].predict(model_ins[model_ins.columns[:-1]])
  return np.concatenate(([preds], [1 - preds]), axis=0).transpose()
  
config_builder = WitConfigBuilder(proto_df_processed[0:num_datapoints]).set_custom_predict_fn(custom_predict_processed)
widget = WitWidget(config_builder, height=tool_height_in_px) 

On a colleague machine (mac) the code worked fine. I tried two different machines but run into the issue both times.

By simply putting a print into the custom_predict function, I could confirm that it is seemingly not used via the data-point-editor predict.

@jameswex
Copy link
Collaborator

What machines did you try it on where it failed and where it succeeded?

Can you provide an exact set of repro steps with a minimal example? The minimal example could use a custom prediction function that returns a number directly from the input example so that we take the actual ML model out of the equation, in terms of what is going wrong.

I just ran a test in colab witih a custom prediction function that logs the calls and it seems to be being called correctly every time the "predict" button is pressed after a datapoint edit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants