<p>Yes, there is a formal solution. You want a heat map of the layers weighting and this is the information sought. It is more difficult to interpret than other supervised learning algorithms, but that is the nature of neural networks. </p>

<p>I know Sci-test Learn (Python), but I don't know R for neural networks, so I can't advise you on the code, only that it will be a few lines of code and a graphical (relative) output. I imagine Tensorflow will have a really brilliant heat map layer weighting.</p>

CC BY-SA 4.0
2019-01-30T18:01:53.543Z
2019-01-30T23:30:16.840Z
2019-01-30T23:30:16.840Z
M__
<p>I have 25 highly differentially expressed genes among and patients to chemotherapy.</p>
<p>I have made a neural network of these genes. The accuracy of the model is <code>0.73</code> but I don't know from 25 genes how I could select the best predictors or remove the weaker ones.</p>
<pre><code>&gt; # Convert column from /to 1/0
&gt; = as.numeric(data$)-1
&gt; data1 = cbind(,df)

&gt; head(data1[,1:4])
   ALB CALML5 CALML6
A2       0 4.64   5.77   3.16
A3       0 7.12   9.13   5.13
A4       0 7.84   7.09   4.85
A6       0 7.90   9.64   6.52
A7       0 5.84   6.26   0.00
A8       0 4.83   5.77   2.15
&gt;
&gt; library(caTools)
&gt; set.seed(101)
&gt; # Create Split (any column is fine)
&gt; split = sample.split(data1<span class="math-container">$, SplitRatio = 0.70)
&gt; # Split based off of split Boolean Vector
&gt; train = subset(data1, split == TRUE)
&gt; test = subset(data1, split == FALSE)
&gt; feats &lt;- names(data[,-1])
&gt; # Concatenate strings
&gt; f &lt;- paste(feats,collapse=' + ')
&gt; f &lt;- paste('TG ~',f)
&gt; # Convert to formula
&gt; f &lt;- as.formula(f)
&gt; f
~ ALB + CALML5 + CALML6 + CDK6 + CHGA + CREB3L3 + CSF3 + 
    CXCL5 + CXCL6 + CXCL8 + DKK1 + EGLN2 + FGF20 + FGF4 + IL11 + 
    IL1B + IL6 + ISG15 + KLK5 + KRT17 + MMP3 + MMP7 + PKP1 + 
    PTGS2 + S100A7A
&gt; #install.packages('neuralnet')
&gt; library(neuralnet)
Warning message:
package ‘neuralnet’ was built under R version 3.5.2 
&gt; nn &lt;- neuralnet(f,train,hidden=c(25,2,1),linear.output=FALSE)
&gt; View(test)
&gt; # Compute Predictions off Test Set
&gt; predicted.nn.values &lt;- compute(nn,test[2:26])
&gt; # Check out net.result
&gt; print(head(predicted.nn.values$</span>net.result))
             [,1]
A4  0.26890819169
B5  0.94836576493
B7  0.19753554824
B8  0.99790838807
B9  0.99764782073
B12 0.05230351043
&gt; predicted.nn.values<span class="math-container">$net.result &lt;- sapply(predicted.nn.values$</span>net.result,round,digits=0)
&gt; table(test<span class="math-container">$Private,predicted.nn.values$</span>net.result)
   
    0 1
  0 4 3
  1 1 7

&gt; accuracy&lt;-(table(test<span class="math-container">$Private,predicted.nn.values$</span>net.result)[1,1]+table(test<span class="math-container">$Private,predicted.nn.values$</span>net.result)[2,2])/(sum(table(test<span class="math-container">$Private,predicted.nn.values$</span>net.result)))


&gt; accuracy
[1] 0.7333333333
&gt;
</code></pre>

CC BY-SA 4.0
2019-01-30T16:13:52.297Z
Usually what I've heard is that one does it so iteratively, so you have now 25, you remove one and see what happens and then remove another one and so on...
llrs
CC BY-SA 4.0
2019-01-30T16:16:00.237Z
Thank you, but what happen to what? I mean in regression I am checking pvalue of coefficient of variation but here I am not which predictor is more influential
Zizogolu
CC BY-SA 4.0
2019-01-30T16:32:42.703Z
Well, you are evaluating the accuracy, so this is your metric you want to follow/to maximize (although I wouldn't forget about specificity).
llrs
<r><rna-seq><transcriptome><clustering><machine-learning>
How I know which gene is a good predictor in this neural network or not?
# How I know which gene is a good predictor in this neural network or not?

(Asked by: username_0 on 2019-01-30)

I have 25 highly differentially expressed genes among and patients to chemotherapy.
I have made a neural network of these genes. The accuracy of the model is 0.73 but I don't know from 25 genes how I could select the best predictors or remove the weaker ones.
> # Convert column from /to 1/0
> = as.numeric(data$)-1
> data1 = cbind(,df)

> head(data1[,1:4])
   ALB CALML5 CALML6
A2       0 4.64   5.77   3.16
A3       0 7.12   9.13   5.13
A4       0 7.84   7.09   4.85
A6       0 7.90   9.64   6.52
A7       0 5.84   6.26   0.00
A8       0 4.83   5.77   2.15
>
> library(caTools)
> set.seed(101)
> # Create Split (any column is fine)
> split = sample.split(data1$, SplitRatio = 0.70)
> # Split based off of split Boolean Vector
> train = subset(data1, split == TRUE)
> test = subset(data1, split == FALSE)
> feats <- names(data[,-1])
> # Concatenate strings
> f <- paste(feats,collapse=' + ')
> f <- paste('TG ~',f)
> # Convert to formula
> f <- as.formula(f)
> f
~ ALB + CALML5 + CALML6 + CDK6 + CHGA + CREB3L3 + CSF3 + 
    CXCL5 + CXCL6 + CXCL8 + DKK1 + EGLN2 + FGF20 + FGF4 + IL11 + 
    IL1B + IL6 + ISG15 + KLK5 + KRT17 + MMP3 + MMP7 + PKP1 + 
    PTGS2 + S100A7A
> #install.packages('neuralnet')
> library(neuralnet)
Warning message:
package ‘neuralnet’ was built under R version 3.5.2 
> nn <- neuralnet(f,train,hidden=c(25,2,1),linear.output=FALSE)
> View(test)
> # Compute Predictions off Test Set
> predicted.nn.values <- compute(nn,test[2:26])
> # Check out net.result
> print(head(predicted.nn.values$net.result))
             [,1]
A4  0.26890819169
B5  0.94836576493
B7  0.19753554824
B8  0.99790838807
B9  0.99764782073
B12 0.05230351043
> predicted.nn.values$net.result <- sapply(predicted.nn.values$net.result,round,digits=0)
> table(test$Private,predicted.nn.values$net.result)
   
    0 1
  0 4 3
  1 1 7

> accuracy<-(table(test$Private,predicted.nn.values$net.result)[1,1]+table(test$Private,predicted.nn.values$net.result)[2,2])/(sum(table(test$Private,predicted.nn.values$net.result)))


> accuracy
[1] 0.7333333333
>

**Tags:** r, rna-seq, transcriptome, clustering, machine-learning
> **Comments:**
> **username_1**: Usually what I've heard is that one does it so iteratively, so you have now 25, you remove one and see what happens and then remove another one and so on...  
> **username_0**: Thank you, but what happen to what? I mean in regression I am checking pvalue of coefficient of variation but here I am not which predictor is more influential  
> **username_1**: Well, you are evaluating the accuracy, so this is your metric you want to follow/to maximize (although I wouldn't forget about specificity).  

---

## 1 answers

### Answer by username_2 on 2019-01-30. Score: 1

Yes, there is a formal solution. You want a heat map of the layers weighting and this is the information sought. It is more difficult to interpret than other supervised learning algorithms, but that is the nature of neural networks.

I know Sci-test Learn (Python), but I don't know R for neural networks, so I can't advise you on the code, only that it will be a few lines of code and a graphical (relative) output. I imagine Tensorflow will have a really brilliant heat map layer weighting.


---

