Classification using the artificial neural network algorithm.

nnetClassification(
  object,
  assessRes,
  scores = c("prediction", "all", "none"),
  decay,
  size,
  fcol = "markers",
  ...
)

Arguments

object

An instance of class "MSnSet".

assessRes

An instance of class "GenRegRes", as generated by nnetOptimisation.

scores

One of "prediction", "all" or "none" to report the score for the predicted class only, for all classes or none.

decay

If assessRes is missing, a decay must be provided.

size

If assessRes is missing, a size must be provided.

fcol

The feature meta-data containing marker definitions. Default is markers.

...

Additional parameters passed to nnet from package nnet.

Value

An instance of class "MSnSet" with

nnet and nnet.scores feature variables storing the classification results and scores respectively.

Author

Laurent Gatto

Examples

library(pRolocdata)
data(dunkley2006)
## reducing parameter search space and iterations 
params <- nnetOptimisation(dunkley2006, decay = 10^(c(-1, -5)), size = c(5, 10), times = 3)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |======================================================================| 100%
params
#> Object of class "GenRegRes"
#> Algorithm: nnet 
#> Hyper-parameters:
#>  decay: 0.1 1e-05
#>  size: 5 10
#> Design:
#>  Replication: 3 x 5-fold X-validation
#>  Partitioning: 0.2/0.8 (test/train)
#> Results
#>  macro F1:
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>  0.7394  0.8434  0.9473  0.8956  0.9736  1.0000 
#>  best decay: 1e-05 0.1   
#>  best size: 5 10   
plot(params)

f1Count(params)
#>        5 10
#> 1e-05  0  0
#> 0.1   NA  1
levelPlot(params)

getParams(params)
#> decay  size 
#>   0.1  10.0 
res <- nnetClassification(dunkley2006, params)
#> [1] "markers"
#> # weights:  269
#> initial  value 683.283502 
#> iter  10 value 389.436994
#> iter  20 value 249.736502
#> iter  30 value 178.340493
#> iter  40 value 165.325969
#> iter  50 value 160.469658
#> iter  60 value 158.052692
#> iter  70 value 157.274930
#> iter  80 value 156.907896
#> iter  90 value 156.721932
#> iter 100 value 156.674206
#> final  value 156.674206 
#> stopped after 100 iterations
getPredictions(res, fcol = "nnet")
#> ans
#>      ER lumen   ER membrane         Golgi Mitochondrion            PM 
#>            18           187            93           106           130 
#>       Plastid      Ribosome           TGN       vacuole 
#>            49            51            21            34 
#> MSnSet (storageMode: lockedEnvironment)
#> assayData: 689 features, 16 samples 
#>   element names: exprs 
#> protocolData: none
#> phenoData
#>   sampleNames: M1F1A M1F4A ... M2F11B (16 total)
#>   varLabels: membrane.prep fraction replicate
#>   varMetadata: labelDescription
#> featureData
#>   featureNames: AT1G09210 AT1G21750 ... AT4G39080 (689 total)
#>   fvarLabels: assigned evidence ... nnet.pred (11 total)
#>   fvarMetadata: labelDescription
#> experimentData: use 'experimentData(object)'
#>   pubMedIds: 16618929 
#> Annotation:  
#> - - - Processing information - - -
#> Loaded on Thu Jul 16 22:53:08 2015. 
#> Normalised to sum of intensities. 
#> Added markers from  'mrk' marker vector. Thu Jul 16 22:53:08 2015 
#> Performed nnet prediction (decay=0.1 size=10) Tue Mar 12 07:14:04 2024 
#> Added nnet predictions according to global threshold = 0 Tue Mar 12 07:14:04 2024 
#>  MSnbase version: 1.17.12 
getPredictions(res, fcol = "nnet", t = 0.75)
#> ans
#>      ER lumen   ER membrane         Golgi Mitochondrion            PM 
#>            14           148            68            93            93 
#>       Plastid      Ribosome           TGN       unknown       vacuole 
#>            41            31            13           160            28 
#> MSnSet (storageMode: lockedEnvironment)
#> assayData: 689 features, 16 samples 
#>   element names: exprs 
#> protocolData: none
#> phenoData
#>   sampleNames: M1F1A M1F4A ... M2F11B (16 total)
#>   varLabels: membrane.prep fraction replicate
#>   varMetadata: labelDescription
#> featureData
#>   featureNames: AT1G09210 AT1G21750 ... AT4G39080 (689 total)
#>   fvarLabels: assigned evidence ... nnet.pred (11 total)
#>   fvarMetadata: labelDescription
#> experimentData: use 'experimentData(object)'
#>   pubMedIds: 16618929 
#> Annotation:  
#> - - - Processing information - - -
#> Loaded on Thu Jul 16 22:53:08 2015. 
#> Normalised to sum of intensities. 
#> Added markers from  'mrk' marker vector. Thu Jul 16 22:53:08 2015 
#> Performed nnet prediction (decay=0.1 size=10) Tue Mar 12 07:14:04 2024 
#> Added nnet predictions according to global threshold = 0.75 Tue Mar 12 07:14:04 2024 
#>  MSnbase version: 1.17.12 
plot2D(res, fcol = "nnet")