Giter Site home page Giter Site logo

statmlben / dnn-locate Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 212.99 MB

dnn-locate is a python module for discriminative features localization based on neural networks.

License: MIT License

Python 2.25% Jupyter Notebook 97.75%
deep-learning feature-selection image-localization interpretability keras localization machine-learning neural-network r2 statistical-analysis xai

dnn-locate's Introduction

Pypi Python License Keras Downloads

๐ŸŽฏ dnn-locate: Data-adaptive discriminative feature localization with statistically guaranteed interpretation

dnn-locate is a Python module for discriminative features localization given a fitted discriminator model, including neural networks. dnn-locate has the following key features:

  1. Adaptive discriminative features. For different instances, dnn-locate is able to provide adaptive discriminative features.
  2. Sparse discriminative features. The discriminative features provided by dnn-locate is sparse.
  3. Statistically guaranteed interpretation in R-square (R2). dnn-locate is able to effectively localize the discriminative features with a target R2 of prediction.

You can find more information for dnn-locate:

TanSoft (Tanh Softmax) activation function

We achieve the (1)-(3) by using the Magic activation: tanh+softmax, namely TanSoft,

from tensorflow.keras import backend as K

def tansoft(x, tau, axis_=(1,2)):
  z = tau*K.softmax(x, axis=axis_)
  z = backend.tanh(backend.relu(z))
  return z

tansoft(x) satisfies that: (i) tansoft(x) <= 1; (ii) ฮฃ tansoft(x) <= tau, that is, each element if controlled by 1, and the sum of all elements is controlled by tau.

Installation

Dependencies

dnn-locate requires: Python>=3.8 + requirements.txt

pip install -r requirements.txt

User installation

Install dnn-locate using pip

pip install dnn-locate
pip install git+https://github.com/statmlben/dnn-locate.git

Example in ECG significant signals localization

  • The 'x-axis' is for different R2 explained by the detected features. From left to right, R2 = [50%, 60%, 70%, 80%].
  • The y-axis is for different instances, each row is for a one instance. The corresponding label is included in the title of each subfigure.

See full ECG localization report here.

Conclusion

  • The localized regions of ECG complexes in sinus rhythm are most informative in distinguishing presence of ventricular ectopic beats from supraventricular ectopic beats in a particular individual. The localized regions lie in the QRS complex, which correlates with ventricular depolarization or electrical propagation in the ventricles. Ion channel aberrations and structural abnormalities in the ventricles can affect electrical conduction in the ventricles, manifesting with subtle anomalies in the QRS complex in sinus rhythm that may not be discernible by the naked eye but is detectable by the convolutional auto-encoder. Of note, as the $R^2$ increases from 10% to 88%, the highlighted color bar is progressively broader, covering a higher proportion of the QRS complex. The foregoing observations are sensible: the regions of interest resided in the QRS complex are biologically plausible and consistent with cardiac electrophysiological principles.

  • As the R2 increases from 80% to 84% and finally 88%, the blue bar progressively highlights the P wave of ECG complexes in sinus rhythm. This observation is consistent with our understanding of the mechanistic underpinnings of atrial depolarization, which correlates with the P wave. Ion channel alterations and structural changes in the atria can affect electrical conduction in the atria manifesting with subtle anomalies in the P wave in sinus rhythm that may not be discernible by the naked eye but are detectable by the convolutional auto-encoder.

  • Collectively, the examples underscore the fact that the discriminative regions of interest identified by our proposed method are biologically plausible and consistent with cardiac electrophysiological principles while locating subtle anomalies in the P wave and QRS complex that may not be discernible by the naked eye. By inspecting our results with an ECG clinician (Dr. Lin Yee Chen), the localized discriminative features of the ECG are consistent with medical interpretation in ECG diagnosis.

Notebook

  • nb_ECG: Implement in ECG dataset
  • nb_MNIST: Implement in MNIST dataset

Replication

If you want to replicate the experiments in our papers, please check the code.

Reference

If you use this code please ๐ŸŒŸ star the repository and cite the following paper:

@article{dai2022locate,
   title={Data-adaptive discriminative feature localization with statistically guaranteed interpretation},
   author={Dai, Ben and Shen, Xiaotong and Chen, Lin Yee and Li, Chunlin and Pan, Wei},
   journal={Annals of Applied Statistics},
   year={2022},
}

dnn-locate's People

Contributors

statmlben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.