Ed.evaluate() of Bayesian GAN for Classification


Hi @dustin,
Although I have not recived clear answer to my previous questions, but it’s highly crucial to know your ideas regarding this issue.
Classification metrics for tf.Tensor output_keys with non-float dtype

Do you have any plan to add the required metrics to solve such problems?

PS: I think the problem is mainly related to ed.RandomVaribale not variable data type(float, int, etc).


The solution is easy to implement. The idea is to 1. like the current code, draw many samples of y_pred through repeated sess.run calls; 2. take the mode of the samples, which will recover the most likely discrete value.

This code would be implemented as an if-clause in the current prediction source code. Namely, we run this if isinstance(output_key, tf.Tensor) and output_key.dtype not in [tf.float16, tf.float32, tf.float64, tf.bfloat16, tf.complex64, tf.complex128].


Thanks Dustin,
I’ll try it, and keep you posted about the result.
Do you have any plan to add it in the main repo?


Not at the moment. It’d be great if someone can implement this and add a PR so we can merge it into the repo.


Hi @dustin,
I tried your help, but I didn’t get where I should add the aforementioned code. could you please let me know where and into which line in evaluate module, I should add the code.
Thanks for your time. :blush:


See the line number in the link above.


I saw,
I just don’t know whether I should add it instead of that if clause there or I should add it as part/below of that if clause there.


The clause attempts to form predictions y_pred by Monte Carlo estimating the posterior predictive mean. The way this is done depends on output_key's data type. Therefore your proposed extension should be part of the if-clause, extending and not replacing the other cases. Does that make sense?


Yeah, fully make sense.
Thanks for your great explanation. :slightly_smiling_face: