{'fraction_non_alphanumeric': 0.033914025324622954, 'fraction_numerical': 0.010847649003951932, 'mean_word_length': 4.720645905420992, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
DeepPINK: reproducible feature selection in deep neural networks

Deep learning has become increasingly popular in both supervised and unsupervised machine learning thanks to its outstanding empirical performance. However, because of their intrinsic complexity, most deep learning methods are largely treated as black box tools with little interpretability. Even though recent attempts have been made to facilitate the interpretability of deep neural networks (DNNs), existing methods are susceptible to noise and lack of robustness. Therefore, scientists are justifiably cautious about the reproducibility of the discoveries, which is often related to the interpretability of the underlying statistical models. In this paper, we describe a method to increase the interpretability and reproducibility of DNNs by incorporating the idea of feature selection with controlled error rate. By designing a new DNN architecture and integrating it with the recently proposed knockoffs framework, we perform feature selection with a controlled error rate, while maintaining high power. This new method, DeepPINK (Deep feature selection using Paired-Input Nonlinear Knockoffs), is applied to both simulated and real data sets to demonstrate its empirical utility.


Introduction
Rapid advances in machine learning techniques have revolutionized our everyday lives and had profound impacts on many contemporary domains such as decision making, healthcare, and finance [28]. In particular, deep learning has received much attention in recent years thanks to its outstanding empirical performance in both supervised and unsupervised machine learning tasks. However, due to the complicated nature of deep neural networks (DNNs) and other deep learning methods, they have been mostly treated as black box tools. In many scientific areas, interpretability of scientific results is becoming increasingly important, as researchers aim to understand why and how a machine learning system makes a certain decision. For example, if a clinical image is predicted to be either benign or malignant, then the doctors are eager to know which parts of the image drive such a prediction. Analogously, if a financial transaction is flagged to be fraudulent, then the security teams want to know which activities or behaviors led to the flagging. Therefore, an explainable and interpretable system to reason about why certain decisions are made is critical to convince domain experts [27].
The interpretability of conventional machine learning models, such as linear regression, random forests, and support vector machines, has been studied for decades. Recently, identifying explainable features that contribute the most to DNN predictions has received much attention. Existing methods either fit a simple model in the local region around the input [33,38] or locally perturb the input to see how the prediction changes [35,6,34,37]. Though these methods can yield insightful interpretations, they focus on specific architectures of DNNs and can be difficult to generalize. Worse still, Ghorbani et al. [22] systematically revealed the fragility of these widely-used methods and demonstrated that even small random perturbation can dramatically change the feature importance. For example, if a particular region of a clinical image is highlighted to explain a malignant classification, the doctors would then focus on that region for further investigation. However, it would be highly problematic if the choice of highlighted region varied dramatically in the presence of very small amounts of noise.
In such a setting, it is desirable for practitioners to select explanatory features in a fashion that is robust and reproducible, even in the presence of noise. Though considerable work has been devoted to creating feature selection methods that select relevant features, it is less common to carry out feature selection while explicitly controlling the associated error rate. Among different feature selection performance measures, the false discovery rate (FDR) [4] can be exploited to measure the performance of feature selection algorithms. Informally, the FDR is the expected proportion of falsely selected features among all selected features, where a false discovery is a feature that is selected but is not truly relevant (For a formal definition of FDR, see section 2.1). Commonly used procedures, such as the Benjamini-Hochberg (BHq) procedure [4], achieve FDR control by working with p-values computed against some null hypothesis, indicating observations that are less likely to be null.
In the feature selection setting, existing methods for FDR control utilize the p-values produced by an algorithm for evaluating feature importance, under the null hypothesis that the feature is not relevant. Specifically, for each feature, one tests the significance of the statistical association between the specific feature and the response either jointly or marginally and obtains a p-value. These p-values are then used to rank the feature importance for FDR control. However, for DNNs, how to produce meaningful p-values that can reflect feature importance is still completely unknown. See, e.g., [19] for the nonuniformity of p-values for the specific case of diverging-dimensional generalized linear models. Without a way to produce appropriate p-values, performing feature selection with a controlled error rate in deep learning is highly challenging.
To bypass the use of p-values but still achieve FDR control, Candès et al. [10] proposed the model-X knockoffs framework for feature selection with controlled FDR. The salient idea is to generate knockoff features that perfectly mimic the arbitrary dependence structure among the original features but are conditionally independent of the response given the original features. Then these knockoff features can be used as control in feature selection by comparing the feature importance between original features and their knockoff counterpart. See more details in section 2.2 for a review of the model-X knockoffs framework and [2,3,10] for more details on different knockoff filters and their theoretical guarantees.
In this paper, we integrate the idea of a knockoff filter with DNNs to enhance the interpretability of the learned network model. Through simulation studies, we discover surprisingly that naively combining the knockoffs idea with a multilayer perceptron (MLP) yields extremely low power in most cases (though FDR is still controlled). To resolve this issue, we propose a new DNN architecture named DeepPINK (Deep feature selection using Paired-Input Nonlinear Knockoffs). DeepPINK is built upon an MLP with the major distinction that it has an additional pairwise-connected layer containing p filters, one per each input feature, where each filter connects the original feature and its knockoff counterpart. We demonstrate empirically that DeepPINK achieves FDR control with much higher power than many state-of-the-art methods in the literature. We also apply DeepPINK to two real data sets to demonstrate its empirical utility. It is also worth mentioning that the idea of DeepPINK may be generalized to other deep neural networks such as CNNs and RNNs, which is the subject of our ongoing research.

Model setting
Consider a supervised learning task where we have n independent and identically distributed (i.i.d.) observations (x i , Y i ), i = 1, · · · , n, with x i ∈ R p the feature vector and Y i the scalar response. Here we consider the high-dimensional setting where the feature dimensionality p can be much larger than the sample size n. Assume that there exists a subset S 0 ⊂ {1, · · · , p} such that, conditional on features in S 0 , the response Y i is independent of features in the complement S c 0 . Our goal is to learn the dependence structure of Y i on x i so that effective prediction can be made with the fitted model and meanwhile achieve accurate feature selection in the sense of identifying features in S 0 with a controlled error rate.

False discovery rate control and the knockoff filter
To measure the accuracy of feature selection, various performance measures have been proposed. The false discovery rate (FDR) is among the most popular ones. For a set of features S selected by some feature selection procedure, the FDR is defined as where | · | stands for the cardinality of a set. Many methods have been proposed to achieve FDR control [5,36,1,15,16,40,14,23,20,44,17]. However, as discussed in Section 1, most of these existing methods rely on p-values and cannot be adapted to the setting of DNNs.
In this paper, we focus on the recently introduced model-X knockoffs framework [10]. The model-X knockoffs framework provides an elegant way to achieve FDR control in a feature selection setting at some target level q in finite sample and with arbitrary dependency structure between the response and features. The idea of knockoff filters was originally proposed in Gaussian linear models [2,3]. The model-X knockoffs framework generalizes the original method to work in arbitrary, nonlinear models. In brief, knockoff filter achieves FDR control in two steps: 1) construction of knockoff features, and 2) filtering using knockoff statistics. Definition 1 ([10]). Model-X knockoff features for the family of random features x = (X 1 , · · · , X p ) T are a new family of random featuresx = (X 1 , · · · ,X p ) T that satisfies two proper- for any subset S ⊂ {1, · · · , p}, where swap(S) means swapping X j andX j for each j ∈ S and d = denotes equal in distribution, and (2)x |= Y |x, i.e.,x is independent of response Y given feature x.
According to Definition 1, the construction of knockoffs is totally independent of the response Y . If we can construct a set of model-X knockoff features, then by comparing the original features with these control features, FDR can be controlled at target level q. See [10] for theoretical guarantees of FDR control with knockoff filters.
Clearly, the construction of model-X knockoff features plays a key role in FDR control. In some special cases such as x ∼ N (0, Σ) with Σ ∈ R p×p the covariance matrix, the model-X knockoff features can be constructed easily. More specifically, if x ∼ N (0, Σ), then a valid construction of knockoff features is Here diag {s} with all components of s being positive is a diagonal matrix the requirement that the conditional covariance matrix in Equation 1 is positive definite. Following the above knockoffs construction, the original features and the model-X knockoff features have the following joint distribution Intuitively, a larger s implies that the constructed knockoff features are more different from the original features and thus can increase the power of the method.
With the constructed knockoff featuresx, we quantify important features via the knockoff by resorting to the knockoff statistics W j = g j (Z j ,Z j ) for 1 ≤ j ≤ p, where Z j andZ j represent feature importance measures for the jth feature X j and its knockoff counterpartX j , respectively, and g j (·, ·) is an antisymmetric function satisfying g j (Z j ,Z j ) = −g j (Z j , Z j ). Note that the feature importance measures as well as the knockoff statistics depend on the specific algorithm used to fit the model. For example, in linear regression models one can choose Z j andZ j as the Lasso regression coefficients of X j andX j , respectively, and a valid knockoff statistic could be W j = |Z j | − |Z j |. See [10] for other suggested constructions for knockoff statistics. A desirable property for knockoff statistics W j 's is that important features are expected to have large positive values, whereas unimportant ones should have small magnitudes symmetric around 0.
Given the knockoff statistics as feature importance measures, we sort |W j |'s in decreasing order and select features whose W j 's exceed some threshold T . In particular, two choices of threshold are suggested [2, 10] is the set of unique nonzero values attained by |W j |'s and q ∈ (0, 1) is the desired FDR level specified by the user. [10] proved that under mild conditions on W j 's, the knockoff filter with T controls a slightly modified version of FDR and the knockoff + filter with T + controls the exact FDR.
When the joint distribution of x is unknown, to construct knockoff features one needs to estimate this distribution from data. For the case of Gaussian design, the approximate knockoff features can be constructed by replacing Σ −1 in Equation 1 with the estimated precision matrix Ω. Following [18], we exploited the ISEE [21] for scalable precision matrix estimation when implementing DeepPINK.

Knockoffs inference for deep neural networks
In this paper, we integrate the idea of knockoff filters with DNNs to achieve feature selection with controlled FDR. We restrict ourselves to a Gaussian design so that the knockoff features can be constructed easily by following Equation 1. In practice, [10] shows how to generate knockoff variables from a general joint distribution of covariates.
We initially experimented with the multilayer preceptron by naively feeding the augmented feature vector (x T ,x T ) T directly into the networks. However, we discovered that although the FDR is controlled at the target level q, the power is extremely low and even 0 in many scenarios; see Table  1 and the discussions in a later section. To resolve the power issue, we propose a new flexible framework named DeepPINK for reproducible feature selection in DNNs, as illustrated in Figure 1.
The main idea of DeepPINK is to feed the network through a pairwise-connected layer containing p filters, F 1 , · · · , F p , where the jth filter connects feature X j and its knockoff counterpartX j . Initialized equally, the corresponding filter weights Z j andZ j compete against each other during training. Thus intuitively, Z j being much larger thanZ j in magnitude provides some evidence that the jth feature is important, whereas similar values of Z j andZ j indicate that the jth feature is not important.
In addition to the competition of each feature against its own knockoff counterpart, features compete against each other. To encourage competitions, we use a linear activation function in the pairwiseconnected layer.
The outputs of the filters are then fed into a fully connected multilayer perceptron (MLP) to learn a mapping to the response Y . The MLP network has multiple alternating linear transformation and nonlinear activation layers. Each layer learns a mapping from its input to a hidden space, and the last layer learns a mapping directly from the hidden space to the response Y . In this work, we use an MLP with 2 hidden layers, each containing p neurons, as illustrated in Figure 1. in the MLP with regularization parameter set to O( 2 log p n ). We use Adam [24] to train the deep learning model with respect to the mean squared error loss, using an initial learning rate of 0.001 and batch size 10.
Let W (0) ∈ R p×1 be the weight vector connecting the filters to the MLP. And let W (1) ∈ R p×p , W (2) ∈ R p×p , and W (3) ∈ R p×1 be the weight matrices connecting the input vector to the hidden layer, hidden layer to hidden layer, and hidden layer to the output, respectively.
The importance measures Z j andZ j are determined by two factors: (1) the relative importance between X j and its knockoff counterpartX j , encoded by filter weights z = (z 1 , · · · , z p ) T and z = (z 1 , · · · ,z p ) T , respectively; and (2) the relative importance of the jth feature among all p features, encoded by the weight matrices, w = W (0) (W (1) W (2) W (3) ), where denotes the entry-wise matrix multiplication. Therefore, we define Z j andZ j as With the above introduced importance measures Z j andZ j , the knockoff statistic can be defined as W j = Z 2 j −Z 2 j , and the filtering step can be applied to the W j 's to select features. Our definition of feature importance measures naturally applies to deep neural nets with more hidden layers. The choice of 2 hidden layers for the MLP is only for illustration purposes.

Simulation studies 4.1 Model setups and simulation settings
We use synthetic data to compare the performance of DeepPINK to existing methods in the literature. Since the original knockoff filter [2] and the high-dimensional knockoff filter [3] were only designed for Gaussian linear regression models, we first simulate data from y = Xβ + ε, where y = (Y 1 , · · · , Y n ) T ∈ R n is the response vector, X ∈ R n×p is a random design matrix, β = (β 1 , β 2 , · · · , β p ) T ∈ R p is the coefficient vector, and ε = (ε 1 , · · · , ε n ) T ∈ R n is a vector of noise.
Since nonlinear models are more pervasive than linear models in real applications, we also consider the following Single-Index model  where g is some unknown link function and x i is the feature vector corresponding to the ith observation.
We simulate the rows of X independently from N (0, Σ) with precision matrix Σ −1 = ρ |j−k| 1≤j,k≤p with ρ = 0.5. The noise distribution is chosen as ε ∼ N (0, σ 2 I n ) with σ = 1. For all simulation examples, we set the target FDR level to q = 0.2.
For the linear model, we experiment with sample size n = 1000, and consider the high-dimensional scenario with number of features p = 50, 100, 200, 400, 600, 800, 1000, 1500, 2000, 2500, and 3000. The true regression coefficient vector β 0 ∈ R p is sparse with s = 30 nonzero signals randomly located, and the nonzero coefficients are randomly chosen from {±1.5}.

Simulation results
We compare the performance of DeepPINK with three popularly used methods, MLP, DeepLIFT [34], random forest (RF) [9], and support vector regression (SVR) with linear kernel. For RF, the feature importance is measured by Gini importance [8]. For MLP, the feature importance is measured similarly to DeepPINK without the pairwise-connected layer. For DeepLIFT, the feature importance is measured by the multiplier score. For SVR with linear kernel, the feature importance is measured by the coefficients in the primal problem [11]. We did not compare with SVR with nonlinear kernel because we could not find any feature importance measure with nonlinear kernel in existing software packages. We would like to point out that with the linear kernel, the model is misspecified when observations are generated from the Single-Index model. Due to the very high computational cost for various methods in high dimensions, for each simulation example, we set the number of repetitions to 20. For DeepPINK and MLP, the neural networks are trained 5 times with different random seeds within each repetition. When implementing the knockoff filter, the threshold T + was used, and the approximate knockoff features were constructed using the estimated precision matrix Ω (see [18] for more details).
The empirical FDR and power are reported in Table 1. We see that DeepPINK consistently control FDR much below the target level and has the highest power among the competing methods in almost all settings. MLP, DeepLIFT, and RF control FDR at the target level, but in each case the power is very sensitive to dimensionality and model nonlinearity. For SVR with the linear kernel, occasionally the FDR is above the target level q = 0.2, which could be caused by the very small number of repetitions. It is worth mentioning that the superiority of DeepPINK over MLP and DeepLIFT lies in the pairwise-connected layer, which encourages the importance competition between original and knockoff features directly. The results on FDR control are consistent with the general theory of knockoffs inference in [10] and [18]. It is worth mentioning that DeepPINK uses the same network architecture across different model settings.

Real data analysis
In addition to the simulation examples presented in Section 4, we also demonstrate the practical utility of DeepPINK on two real applications.. For all studies the target FDR level is set to q = 0.2.

Application to HIV-1 data
We first apply DeepPINK to the task of identifying mutations associated with drug resistance in HIV-1 [32]. Separate data sets are available for resistance against different drugs from three classes: 7 protease inhibitors (PIs), 6 nucleoside reverse-transcriptase inhibitors (NRTIs), and 3 nonnucleoside reverse transcriptase inhibitors (NNRTIs). The response Y is the log-transformed drug resistance level to the drug, and the jth column of the design matrix X indicates the presence or absence of the jth mutation.
We compare the identified mutations, within each drug class, against the treatment-selected mutations (TSM), which contains mutations associated with treatment by the drug from that class. Following [2], for each drug class, we consider the jth mutation as a discovery for that drug class as long as it is selected for any of the drugs in that class. Before running the selection procedure, we remove patients with missing drug resistance information and only keep those mutations which appear at least three times in the sample. We then apply three different methods to the data set: DeepPINK with model-X knockoffs discussed earlier in this paper, the original fixed-X knockoff filter based on a Gaussian linear model (Knockoff) proposed in [2], and the Benjamini-Hochberg (BHq) procedure [4]. Following [2], z-scores rather than p-values are used in BHq to facilitate comparison with other methods. Figure 2 summarizes the discovered mutations of all methods within each drug class for PI and NRTI. In this experiment, we see several differences among the methods. Compared to Knockoff, DeepPINK obtains equivalent or better power in 9 out of 13 cases with comparable false discovery proportion. In particular, DeepPINK and BHq are the only methods that can identify mutations in DDI, TDF, and X3TC for NRTI. Compared to BHq, DeepPINK obtains equivalent or better power in 10 out of 13 cases with with much better controlled false discovery proportion. In particular, DeepPINK shows remarkable performance for APV where it recovers 18 mutations without any mutation falling outside the TSM list. Finally, it is worth mentioning that DeepPINK does not make assumptions about the underlying models.

Application to gut microbiome data
We next apply DeepPINK to the task of identifying the important nutrient intake as well as bacteria genera in the gut that are associated with body-mass index (BMI). We use a cross-sectional study of n = 98 healthy volunteers to investigate the dietary effect on the human gut microbiome [12,26,45]. The nutrient intake consists of p 1 = 214 micronutrients whose values are first normalized using the residual method to adjust for caloric intake and then standardized [12]. Furthermore, the composition of p 2 = 87 genera are extracted using 16S rRNA sequencing from stool samples. the compositional data is first log-ratio transformed to get rid of the sum-to-one constraint and then centralized. Following [26], 0s are replaced with 0.5 before converting the data to compositional form. Therefore, we treat BMI as the response and the nutrient intake together with genera composition as predictors. Table 2 shows the eight identified nutrient intake and bacteria genera using DeepPINK with the target FDR level q = 0.2. Among them, three overlap with the four genera (Acidaminococcus, Alistipes, Allisonella, Clostridium) identified in [26] using Lasso. At the phylum level, it is known that firmicutes affect human obesity [26], which is consistent with identified firmicutes-dominated genera. In view of the associations with BMI, all identified genera and nutrient intake by DeepPINK are supported by literature evidence shown in Table 2.

Conclusion
We have introduced a new method, DeepPINK, that can help to interpret a deep neural network model by identifying a subset of relevant input features, subject to the FDR control. DeepPINK employs a particular DNN architecture, namely, the pairwise-connected layer, to encourage competitions   between each original feature and its knockoff counterpart. DeepPINK achieves FDR control with much higher power then the naive combination of the knockoffs idea with a vanilla multilayer perceptron. Extending DeepPINK to other neural networks such as CNN and RNN would be interesting directions for future.
Reciprocally, DeepPINK in turn improves on the original knockoff inference framework. It is worth mentioning that feature selection always relies on some importance measures explicitly or implicitly (e.g., Gini importance [8] in random forest). One drawback is that the feature importance measures heavily depend on the specific algorithm used to fit the model. Given the universal approximation property of DNNs, practitioners can now avoid having to handcraft feature importance measures with the help of DeepPINK.