DeepExplain | unified framework of perturbation | Machine Learning library

 by   marcoancona Python Version: Current License: MIT

kandi X-RAY | DeepExplain Summary

kandi X-RAY | DeepExplain Summary

DeepExplain is a Python library typically used in Artificial Intelligence, Machine Learning, Deep Learning, Tensorflow applications. DeepExplain has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can download it from GitHub.

DeepExplain: attribution methods for Deep Learning [Build Status] === DeepExplain provides a unified framework for state-of-the-art gradient and perturbation-based attribution methods. It can be used by researchers and practitioners for better undertanding the recommended existing models, as well for benchmarking other attribution methods. It supports Tensorflow as well as Keras with Tensorflow backend. Only Tensorflow V1 is supported. For V2, there is an open pull-request, that works if eager execution is disabled.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              DeepExplain has a low active ecosystem.
              It has 675 star(s) with 126 fork(s). There are 36 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 31 open issues and 33 have been closed. On average issues are closed in 25 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of DeepExplain is current.

            kandi-Quality Quality

              DeepExplain has 0 bugs and 0 code smells.

            kandi-Security Security

              DeepExplain has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              DeepExplain code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              DeepExplain is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              DeepExplain releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              DeepExplain saves you 532 person hours of effort in developing the same functionality from scratch.
              It has 1246 lines of code, 137 functions and 8 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed DeepExplain and discovered the below as its top functions. This is intended to give you an instant insight into DeepExplain implemented functionality, and help decide if they suit your requirements.
            • Runs the perturbation loop
            • Evaluate the session
            • Check that inputs are compatible
            • Converts x to a list
            • Run a single batch of data
            • Make a list of mini - batches
            • Unpack a singleton
            • Slice arrays
            • Runs the experiment
            • Run the optimizer
            • The symbolic link of the symbol
            • Override nonlinearity gradient
            • Calculate the gradients of the given op
            • Get activation function
            • Reverse gradient op
            • Runs the session
            Get all kandi verified functions for this library.

            DeepExplain Key Features

            No Key Features are available at this moment for DeepExplain.

            DeepExplain Examples and Code Snippets

            No Code Snippets are available at this moment for DeepExplain.

            Community Discussions

            QUESTION

            SHAP DeepExplainer with TensorFlow 2.4+ error
            Asked 2021-Jun-14 at 14:52

            I'm trying to compute shap values using DeepExplainer, but I get the following error:

            keras is no longer supported, please use tf.keras instead

            Even though i'm using tf.keras?

            ...

            ANSWER

            Answered 2021-Jun-14 at 14:52

            TL;DR

            • Add tf.compat.v1.disable_v2_behavior() at the top for TF 2.4+
            • calculate shap values on numpy array, not on df

            Full reproducible example:

            Source https://stackoverflow.com/questions/66814523

            QUESTION

            Interpreting recurrent neural networks features (RNN/LSTM)
            Asked 2021-May-14 at 21:22

            I tried to use shap in order to do a feature importance analysis. I am using keras and I want to get a bar chart and violin charts. With my DNN, I got something like that: Violin chart bar chart

            However, when I tried it with my SimpleRNN, I had problem with the shape. The input shape is (samples,time,features), whereas my output shape is (samples,features). So it is a many-to-one RNN. KernelExplainer, the one that I used in my static models, does not work because of the dimension. DeepExplainer does not work either. It show me this error:

            ...

            ANSWER

            Answered 2021-May-14 at 21:22

            I managed to fix it by adding at the beginning of my code

            Source https://stackoverflow.com/questions/67533326

            QUESTION

            Error using shap with SimpleRNN sequential model
            Asked 2020-Oct-24 at 14:43

            In the code below, I import a saved sparse numpy matrix, created with python, densify it, add a masking, batchnorm and dense ouptput layer to a many to one SimpleRNN. The keras sequential model works fine, however, I am unable to use shap. This is run in Jupyter lab from Winpython 3830 on a Windows 10 desktop. The X matrix has a shape of (4754, 500, 64): 4754 examples with 500 timesteps and 64 variables. I've created a function to simulate the data so the code can be tested. The simulated data returns the same error.

            ...

            ANSWER

            Answered 2020-Oct-24 at 14:43

            The owner of the shap repo said:

            The fundamental issue here is that DeepExplainer does not yet support TF 2.0.

            That was on 11 Dec 2019. Is this still the case? Try it with Tensorflow 1.15 and see if that works.

            Another issue on the shap repo about this (2 Jun 2020) says:

            Alright, thank you. I did not see the post by Lundberg. I will stick to the workaround of using TF 1.15 until a new version of SHAP is released.

            Source https://stackoverflow.com/questions/64401570

            QUESTION

            During handling of the above exception, another exception occurred when using SHAP to interpret keras neural network model
            Asked 2020-Aug-12 at 12:57

            The x_train looks like this (22 features):

            ...

            ANSWER

            Answered 2020-Aug-12 at 12:36

            I think SHAP (whatever it is) is expecting a Numpy array and so indexing x_train like a Numpy array, it yields an error. Try:

            Source https://stackoverflow.com/questions/63376600

            QUESTION

            Does SHAP in Python support Keras or TensorFlow models while using DeepExplainer?
            Asked 2020-Apr-30 at 07:10

            I am currently using SHAP Package to determine the feature contributions. I have used the approach for XGBoost and RandomForest and it worked really well. Since the data I am working on is a sequential data I tried using LSTM and CNN to train the model and then get the feature importance using the SHAP's DeepExplainer; but it is continuously throwing error. The error I am getting is:

            ...

            ANSWER

            Answered 2020-Apr-30 at 07:05

            The returned value of model.fit is not the model instance; rather, it's the history of training (i.e. stats like loss and metric values) as an instance of keras.callbacks.History class. That's why you get the mentioned error when you pass the returned History object to shap.DeepExplainer. Instead, you should pass the model instance itself:

            Source https://stackoverflow.com/questions/61516930

            QUESTION

            SHAP DeepExplainer: shap_values containing "nan" values
            Asked 2020-Apr-07 at 06:26

            I have an issue with my shap values, here is my model:

            ...

            ANSWER

            Answered 2020-Apr-07 at 06:26

            Okay, via reading shap's source code, I realised it didn't take into account that the data were pandas' dataframes, eventhought the documentation says otherwise.

            It worked using numpy.arrays

            Source https://stackoverflow.com/questions/60986016

            QUESTION

            Shap LSTM (Keras, TensorFlow) ValueError: shape mismatch: objects cannot be broadcast to a single shape
            Asked 2020-Apr-01 at 14:44

            Im trying to plot summary from simple LSTM model. Im getting ValueError: shape mismatch: objects cannot be broadcast to a single shape when calling shap.summary_plot. Colab that reproduces the issue

            ...

            ANSWER

            Answered 2020-Mar-30 at 08:39

            From the documentation, the first two arguments of shap.summary_plot are:

            shap_values: numpy.array For single output explanations this is a matrix of SHAP values (# samples x # features). For multi-output explanations this is a list of such matrices of SHAP values.

            features: numpy.array or pandas.DataFrame or list Matrix of feature values (# samples x # features) or a feature_names list as shorthand.

            In the code that you provided, both shap_vals[0] and val_x[:10] have shape (10, 5, 4). Therefore, you should either flatten the first and second dimensions or select the timepoint you are interested in. For example:

            Source https://stackoverflow.com/questions/60894506

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install DeepExplain

            You can download it from GitHub.
            You can use DeepExplain like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            DeepExplain is still in active development. If you experience problems, feel free to open an issue. Contributions to extend the functinalities of this framework and/or to add support for other methods are welcome.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/marcoancona/DeepExplain.git

          • CLI

            gh repo clone marcoancona/DeepExplain

          • sshUrl

            git@github.com:marcoancona/DeepExplain.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link