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
911 stars 170 forks source link

What If tool returning error #238

Open guruvittal opened 3 months ago

guruvittal commented 3 months ago

Hi,

When trying to run the WIT, the model oredict function returns an error, when we click the predict button: TypeError('array([34.62574], dtype=float32) has type numpy.ndarray, but expected one of: int, float')

Notebook having this issue: https://github.com/PAIR-code/what-if-tool/blob/master/WIT_Age_Regression.ipynb

I was able to simulate with another model as well.

jameswex commented 3 months ago

Thanks for the bug report. The What-If Tool isn't in active development, so regressions like this aren't too surprising if our demos don't have perfectly-locked version numbers of all downstream dependencies. I'm guessing what is happening here is that a new version of some package used by the tensorflow estimator code for this model has changed the format with which the predictions are returned, leading to the tool's front-end being given a list instead of a raw prediction value (float) for each datapoint.

One simple solution for this would be to update this demo to move away from use of tensorflow estimator and towards a different model api that could have a simple WIT custom prediction function written to wrap it.