Skip to content

sum(attributions) not equal to F(input)-F(baseline) in DeepLIFT? #57

@zhangxiang390

Description

@zhangxiang390

demo code is:

with DeepExplain(session=sess) as de:
    explainer = de.get_explainer('deeplift', T=model[1], X=model[0],
                                 baseline=df_train_feature.values[0].astype(float))
    attributions = explainer.run(df_test_feature.values.astype(float))

preds = sess.run(model[1], feed_dict={model[0]: df_test_feature.values.astype(float)})
baseline_pred = sess.run(model[1], feed_dict={model[0]: np.expand_dims(df_train_feature.values[0].astype(float), axis=0)})
print('baseline_pred:{}'.format(baseline_pred))

diff = np.squeeze(preds) - attributions.sum(1)
plt.plot(diff)
plt.title('{}'.format('pred_MINUS_sum_of_attr'))
plt.show()

image

I expected the 'diff' is near baseline_pred(3.473), but from the above plot, It centered at 0 and has large variance.

I'm very confused, can anybody give me some explanations? thanks a million

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions