WIT implementaion on xgboodt custom model on Jupyter notebook

38 views
Skip to first unread message

Albin Thomas

unread,
May 18, 2021, 8:21:08 AM5/18/21
to What-If Tool
I have been trying to invoke the tool on the Xgboost model for a while but cannot find a parameter to pass the model for the tool as it is because it is not a tf.estimator model. How can I acheive this.  
which function should i use to invoke the model and input it?

jwe...@google.com

unread,
May 18, 2021, 9:20:58 AM5/18/21
to What-If Tool
For an xgboost model, you'll want to use WIT's custom prediction function ability. See https://pair-code.github.io/what-if-tool/learn/tutorials/custom-prediction/ for more information. You should be able to define your own python function that does the prediction on a list of input examples and returns a list of outputs for those examples. That function can make use of your trained xgboost model.

Another option is to deploy your xgboost model to Google Cloud AI Platform Prediction and use WIT's ability to query models served through AI Platform Prediction. But the custom prediction function will be a much simpler approach for your use case most likely.

https://colab.sandbox.google.com/github/pair-code/what-if-tool/blob/master/WIT_Toxicity_Text_Model_Comparison.ipynb is one colab notebook that shows use of custom prediction functions, although not with xgboost models. Other notebooks that show use of custom prediction functions can be found in the list at https://pair-code.github.io/what-if-tool/explore/#notebook
Reply all
Reply to author
Forward
0 new messages