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] -95.094987 0.5269887 257.30611 #> unclassified Fusobacterium [c:1481] 19.793839 29.2345090 32.48733 #> Pseudoflavonifractor capillosus [h:1579] -21.451579 30.7454712 166.60164 #> Porphyromonas asaccharolytica [h:1056] 29.182380 28.4305549 41.46582 #> Prevotella nigrescens [h:1069] 36.933694 36.2547827 40.99035 #> Peptostreptococcus stomatis [h:1530] -5.094556 21.3835589 80.62460 #> mean.rel.weight median.rel.weight #> unclassified Fusobacterium [c:1482] -0.0301846342 0.0004570326 #> unclassified Fusobacterium [c:1481] -0.0001278288 0.0195451964 #> Pseudoflavonifractor capillosus [h:1579] 0.0151405614 0.0252825304 #> Porphyromonas asaccharolytica [h:1056] 0.0063587682 0.0175983706 #> Prevotella nigrescens [h:1069] 0.0235607690 0.0338731179 #> Peptostreptococcus stomatis [h:1530] -0.0027804450 0.0207560497 #> sd.rel.weight percentage #> unclassified Fusobacterium [c:1482] 0.04926960 1 #> unclassified Fusobacterium [c:1481] 0.04043017 1 #> Pseudoflavonifractor capillosus [h:1579] 0.03123462 1 #> Porphyromonas asaccharolytica [h:1056] 0.02792042 1 #> Prevotella nigrescens [h:1069] 0.02256343 1 #> Peptostreptococcus stomatis [h:1530] 0.04215574 1