Skip to contents

Calculates class weights to be used for parameter optimisation and classification such as svmOptimisation or svmClassification - see the pRoloc tutorial vignette for an example. The weights are calculated for all non-unknown classes the inverse of the number of observations.

Usage

classWeights(object, fcol = "markers")

Arguments

object

An instance of class MSnSet

fcol

The name of the features to be weighted

Value

A table of class weights

Author

Laurent Gatto

Examples

library("pRolocdata")
data(hyperLOPIT2015)
classWeights(hyperLOPIT2015)
#> 
#>                          40S Ribosome                          60S Ribosome 
#>                           0.037037037                           0.023255814 
#>                    Actin cytoskeleton                               Cytosol 
#>                           0.076923077                           0.023255814 
#> Endoplasmic reticulum/Golgi apparatus                              Endosome 
#>                           0.009345794                           0.076923077 
#>                  Extracellular matrix                              Lysosome 
#>                           0.076923077                           0.030303030 
#>                         Mitochondrion                   Nucleus - Chromatin 
#>                           0.002610966                           0.015625000 
#>               Nucleus - Non-chromatin                            Peroxisome 
#>                           0.011764706                           0.058823529 
#>                       Plasma membrane                            Proteasome 
#>                           0.019607843                           0.029411765 
data(dunkley2006)
classWeights(dunkley2006)
#> 
#>      ER lumen   ER membrane         Golgi Mitochondrion            PM 
#>    0.07142857    0.02222222    0.03571429    0.01818182    0.02173913 
#>       Plastid      Ribosome           TGN       vacuole 
#>    0.05000000    0.05263158    0.07692308    0.04761905