Function to extract the feature weights from a SIAMCAT object

feature_weights(siamcat, verbose=1)

# S4 method for siamcat
feature_weights(siamcat, verbose = 1)

Arguments

siamcat

(Required). A siamcat-class object that contains trained models

verbose

integer, if the slot is empty, should a message be printed? values can be either 0 (no output) or 1 (print message)

Value

A dataframe containing mean/median feature weight and additional info or NULL

Details

The function extracts the weight matrix from all trained models (see weight_matrix) and computes several metrics on the feature weights:

  • mean.weight - mean weight across trained models

  • median.weight - median weight across trained models

  • sd.weight - standard deviation of the weight across trained models

  • mean.rel.weight - mean relative weight across trained models (each model is normalized by the absolute of all weights)

  • median.rel.weight - median relative weight across trained models

  • sd.rel.weight - standard deviation of the relative weight across trained models

  • percentage - percentage of models in which this feature was selected (i.e. non-zero)

Examples

data(siamcat_example)
temp <- feature_weights(siamcat_example)
head(temp)
#>                                          mean.weight median.weight sd.weight
#> unclassified Fusobacterium [c:1482]       -22.911573     -8.840574  33.90188
#> unclassified Fusobacterium [c:1481]         6.531374      4.258957  26.13803
#> Pseudoflavonifractor capillosus [h:1579]   26.610582     27.392341  21.85843
#> Porphyromonas asaccharolytica [h:1056]     13.051833     11.900938  14.93073
#> Prevotella nigrescens [h:1069]             28.578953     23.931092  30.93435
#> Peptostreptococcus stomatis [h:1530]        7.996267      1.586044  22.85606
#>                                          mean.rel.weight median.rel.weight
#> unclassified Fusobacterium [c:1482]         -0.041840339      -0.014960815
#> unclassified Fusobacterium [c:1481]         -0.008315680       0.003723249
#> Pseudoflavonifractor capillosus [h:1579]     0.023496680       0.028361676
#> Porphyromonas asaccharolytica [h:1056]       0.008233728       0.015489473
#> Prevotella nigrescens [h:1069]               0.032268581       0.036707175
#> Peptostreptococcus stomatis [h:1530]        -0.002017143       0.002353617
#>                                          sd.rel.weight percentage
#> unclassified Fusobacterium [c:1482]         0.05649630        0.9
#> unclassified Fusobacterium [c:1481]         0.03492352        1.0
#> Pseudoflavonifractor capillosus [h:1579]    0.02528359        1.0
#> Porphyromonas asaccharolytica [h:1056]      0.01349503        1.0
#> Prevotella nigrescens [h:1069]              0.02671583        1.0
#> Peptostreptococcus stomatis [h:1530]        0.02660175        1.0