PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
921 stars 170 forks source link

Multiclass classification #205

Open swaticolab opened 2 years ago

swaticolab commented 2 years ago

Hi Team,

I see that there is one demo prepared for the multiclass classification of Iris dataset. I was trying to do the same, and added the option of .set_multi_class(True)in the WitConfigBuilder. But in my output report I am seeing the page as below:

image

This output does not see right. Is there something that I am missing. Below is the adjust_prediction function i am using:

def adjust_prediction(x):
  x_df = pd.DataFrame(x, columns=data.columns.tolist())
  return bst.predict_proba(x_df)

Is there any sample notebook running behind Iris demo?

jameswex commented 2 years ago

I believe your problem will be solved if you provide WIT with a label vocab that converts the class indicies for your prediction lists into readable names. See the last cell in https://colab.sandbox.google.com/github/pair-code/what-if-tool/blob/master/WIT_Model_Comparison.ipynb#scrollTo=NUQVro76e38Q for example.

You will call something like .set_label_vocab(['Setosa', 'Versicolor', 'Verginica']) when constructing the wit widget.