2
$\begingroup$

I have 25 highly differentially expressed genes among and patients to chemotherapy.

I have made a neural network of these genes. Accuracy of model is 0.73 but I don't know from 25 genes how I could select the best predictors or remove the weaker one. Any help please

> # 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
>
$\endgroup$
  • $\begingroup$ 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... $\endgroup$ – llrs Jan 30 '19 at 16:13
  • $\begingroup$ 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 $\endgroup$ – Exhausted Jan 30 '19 at 16:16
  • 1
    $\begingroup$ Well, you are evaluating the accuracy, so this is your metric you want to follow/to maximize (although I wouldn't forget about specificity). $\endgroup$ – llrs Jan 30 '19 at 16:32
1
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.