Package: dnn-locate
🎯dnn-locate: Data-adaptive discriminative feature localization withstatistically guaranteed interpretationdnn-locateis a Python module for discriminative features localization given a fitted discriminator model, includingneural networks.dnn-locatehas the following key features:Adaptive discriminative features. For different instances,dnn-locateis able to provideadaptivediscriminative features.Sparse discriminative features. The discriminative features provided bydnn-locateis sparse.Statistically guaranteed interpretation in R-square (R2).dnn-locateis able toeffectivelylocalize the discriminative features with a target R2 of prediction.You can find more information fordnn-locate:GitHub repo:https://github.com/statmlben/dnn-inferencePyPi:https://pypi.org/project/dnn-locate/Magicactivation functionWe achieve the (1)-(3) by using theMagicactivation:tanh+relu+softmaxfromkerasimportbackendasKdeftanh_relu(x,tau,axis_=(1,2)):z=tau*K.softmax(x,axis=axis_)z=backend.tanh(backend.relu(z))returnztanh_relu(x)satisfies that: (i)tanh_relu(x) <= 1; (ii)Σ tanh_relu(x) <= tau, that is, each element if controlled by 1, and the sum of all elements is controlled bytau.InstallationDependenciesdnn-locaterequires:Python>=3.8+requirements.txtpipinstall-rrequirements.txtUser installationInstalldnn-locateusingpippipinstalldnn-locate
pipinstallgit+https://github.com/statmlben/dnn-locate.gitExample inECGsignificant signals localizationThe '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 reporthere.ConclusionThe 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 theQRS 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 thatmay 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 andconsistent 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 isconsistent 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 whilelocating 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.Notebooknb_ECG: Implement in ECG datasetnb_MNIST: Implement in MNIST datasetReplicationIf you want to replicate the experiments in our papers, please check thecode.ReferenceIf 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},}