🎯 dnn-locate#

PyPi Keras MIT Python3 tensorflow downloads downloads_month


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. Adaptiveness. For different instances, dnn-locate is able to provide adaptive discriminative features.

  2. Sparseness. 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:

TRUST (Tanh RelU SofTmax) activation function#

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

from tensorflow.keras import backend as K

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

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


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

   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},
   publisher={Institute of Mathematical Statistics}

📒 Contents#

Indices and tables#