Python/Keras implementation of integrated gradients presented in "Axiomatic Attribution for Deep Networks" for explaining any model defined in Keras framework.
When trying to run with a dense feedforward network I get the following error:
Traceback (most recent call last):
File "avocado_fit.py", line 66, in <module>
ig = integrated_gradients(model)
File "/net/noble/vol1/home/jmschr/proj/avocado/exps/2_13_18_Intepretability/IntegratedGradients.py", line 57, in __init__
self.outchannels = range(model1.output._keras_shape[1])
NameError: global name 'model1' is not defined
This can be traced back to this code:
if len(self.outchannels) == 0:
if verbose: print("Evaluated output channel (0-based index): All")
if K.backend() == "tensorflow":
self.outchannels = range(self.model.output.shape[1]._value)
elif K.backend() == "theano":
self.outchannels = range(model1.output._keras_shape[1])
model1 isn't defined. I switched it over to model, is that the right fix?
When trying to run with a dense feedforward network I get the following error:
This can be traced back to this code:
model1
isn't defined. I switched it over tomodel
, is that the right fix?