marcoancona / DeepExplain

A unified framework of perturbation and gradient-based attribution methods for Deep Neural Networks interpretability. DeepExplain also includes support for Shapley Values sampling. (ICLR 2018)
https://arxiv.org/abs/1711.06104
MIT License
720 stars 133 forks source link

None values not supported. #60

Closed RochanaChaturvedi closed 4 years ago

RochanaChaturvedi commented 4 years ago

Hi, I was running the following code without any issue until recently, when I updated the installation of DeepExplain in my google colab:

with DeepExplain(session=K.get_session()) as de: fmodel=Model(model.input,dense) fmodel.set_weights(model.get_weights()) fmodel.compile(optimizer='nadam', loss='binary_crossentropy',metrics=['accuracy',f1])

    input_tensor = fmodel.layers[0].input
    embedding = fmodel.layers[1].output
    get_embedding_out = K.function([input_tensor],[embedding])
    embedding_out=get_embedding_out([x])
    pre_softmax_tensor = fmodel.layers[-1].output
    new_input_tensor = fmodel.layers[1].input

    attributions = de.explain('elrp',  pre_softmax_tensor, new_input_tensor, embedding_out)
    attr= np.sum(attributions, -1)

I am receiving ValueError: None values not supported in de.explain(): /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape, allow_broadcast) 452 else: 453 if values is None: --> 454 raise ValueError("None values not supported.") 455 # if dtype is provided, forces numpy array to be the type 456 # provided if possible.

I am using tensorflow version 1.15.

Please help.

RochanaChaturvedi commented 4 years ago

Figured out the problem was with embedding lookup. Thanks for your excellent work!