Coder Social home page Coder Social logo

dipanjans / explainable_artificial_intelligence Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 28.0 59.04 MB

Slides, code and resources for model interpretation methods in machine learning and deep learning

License: GNU General Public License v3.0

Jupyter Notebook 99.96% Python 0.04%

explainable_artificial_intelligence's Introduction

explainable_artificial_intelligence

Slides, code and resources for model interpretation methods in machine learning and deep learning

explainable_artificial_intelligence's People

Contributors

dipanjans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

explainable_artificial_intelligence's Issues

Getting an error with Interpreting_Vision_Models_1; using SHAP to explain how 7th layer of VGG16 Model impacts prediction

I've been trying to replicate this code and I have been stuck on this particular issue. When I try to run shap.GradientExplainer() for the 7th layer, I keep getting the same error:

1 def map2layer(x, layer):
----> 2     feed_dict = dict(zip([model.layers[7].input], [preprocess_input(x.copy())]))
      3     print(feed_dict.keys().type)
      4     return K.get_session().run(model.layers[layer].input, feed_dict)

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/keras_tensor.py in __hash__(self)
    259   def __hash__(self):
    260     raise TypeError('Tensors are unhashable. (%s)'
--> 261                     'Instead, use tensor.ref() as the key.' % self)
    262 
    263   # Note: This enables the KerasTensor's overloaded "right" binary

TypeError: Tensors are unhashable. (KerasTensor(type_spec=TensorSpec(shape=(None, 56, 56, 128), dtype=tf.float32, name=None), name='block2_pool/MaxPool:0', description="created by layer 'block2_pool'"))Instead, use tensor.ref() as the key.

I have tried downgrading my tensorflow version to below 2.0 but it still hasn't worked. Would love to hear a fix for this.

explainer = shap.DeepExplainer(dnn_model, data=X_train)

Getting error message from here.

/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
    230                          ', found ndim=' + str(ndim))
    231     if spec.min_ndim is not None:
--> 232       ndim = x.shape.rank
    233       if ndim is not None and ndim < spec.min_ndim:
    234         raise ValueError('Input ' + str(input_index) + ' of layer ' +

AttributeError: 'tuple' object has no attribute 'rank'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.