get pbg_metrics data frames

ingest_training_stats(
  simba_ref,
  gg_dirname = "graph0",
  tr_output = "model",
  jsonpath
)

Arguments

simba_ref

reference to simba module

gg_dirname

character(1) the dirname specified for build_and_train_pbg, defaults to 'graph0'

tr_output

character(1) the output specified for build_and_train_pbg defaults to 'model'

jsonpath

character(1) path to training_stats.json

Value

a list with two data.frames of training statistics

Examples

# full run-based, commented out as too long
# p3k = get_10x3kpbmc_path(overwrite=TRUE) # allow repetition
# ref = simba_ref()
# pp = ref$read_h5ad(p3k)
# bb = basic_preproc(pp, simba_ref=ref)
# gg = build_and_train_pbg( bb, simba_ref=ref )
# ts = ingest_training_stats(ref)
# head(ts$df1)
#
# use archived pbg output
#
tpath = system.file(file.path("extdata", "pbg3k.tar.xz"), package="Simba4Bioc")
untar(tpath, exdir = tempdir())
jsonpath = paste0(tempdir(), "/pbg/graph0/model/training_stats.json")
ts = ingest_training_stats(jsonpath=jsonpath)
head(ts$df1)
#>   lhs_partition rhs_partition index stats_count stats_metrics_loss
#> 1             0             0     1     2168828           22.12636
#> 2             0             0     2     2168828           21.75738
#> 3             0             0     3     2168828           21.68153
#> 4             0             0     4     2168828           21.63829
#> 5             0             0     5     2168828           21.59264
#> 6             0             0     6     2168828           21.56029
#>   stats_metrics_reg stats_metrics_violators_lhs stats_metrics_violators_rhs
#> 1                 0                    46.32678                    32.14047
#> 2                 0                    40.77371                    28.66915
#> 3                 0                    39.70222                    28.13866
#> 4                 0                    39.12694                    27.83895
#> 5                 0                    38.54704                    27.51283
#> 6                 0                    38.03881                    27.23536
#>   eval_stats_before_count eval_stats_before_metrics_loss
#> 1                  114148                       22.83474
#> 2                  114148                       21.95265
#> 3                  114148                       21.87745
#> 4                  114148                       21.87963
#> 5                  114148                       21.87675
#> 6                  114148                       21.88132
#>   eval_stats_before_metrics_pos_rank eval_stats_before_metrics_mrr
#> 1                           50.38945                    0.05141226
#> 2                           37.69553                    0.07409224
#> 3                           37.43978                    0.07544834
#> 4                           37.53849                    0.07443034
#> 5                           37.59927                    0.07421614
#> 6                           37.73723                    0.07349054
#>   eval_stats_before_metrics_r1 eval_stats_before_metrics_r10
#> 1                  0.009500823                     0.0995243
#> 2                  0.015720819                     0.1642123
#> 3                  0.016706381                     0.1666083
#> 4                  0.015931072                     0.1650095
#> 5                  0.015865368                     0.1638005
#> 6                  0.015501805                     0.1623594
#>   eval_stats_before_metrics_r50 eval_stats_before_metrics_auc
#> 1                     0.5015200                     0.5064259
#> 2                     0.6985668                     0.6289554
#> 3                     0.7022593                     0.6335372
#> 4                     0.7006693                     0.6332349
#> 5                     0.6998765                     0.6336554
#> 6                     0.6982426                     0.6340759
#>   eval_stats_after_count eval_stats_after_metrics_loss
#> 1                 114148                      21.95206
#> 2                 114148                      21.88233
#> 3                 114148                      21.87859
#> 4                 114148                      21.87929
#> 5                 114148                      21.88089
#> 6                 114148                      21.89812
#>   eval_stats_after_metrics_pos_rank eval_stats_after_metrics_mrr
#> 1                          37.72470                   0.07398883
#> 2                          37.48253                   0.07540224
#> 3                          37.53962                   0.07441796
#> 4                          37.59962                   0.07433443
#> 5                          37.70173                   0.07379338
#> 6                          37.78983                   0.07285376
#>   eval_stats_after_metrics_r1 eval_stats_after_metrics_r10
#> 1                  0.01556313                    0.1638180
#> 2                  0.01670200                    0.1665995
#> 3                  0.01586537                    0.1648868
#> 4                  0.01589603                    0.1642210
#> 5                  0.01586537                    0.1629814
#> 6                  0.01508568                    0.1613695
#>   eval_stats_after_metrics_r50 eval_stats_after_metrics_auc epoch_idx
#> 1                    0.6976469                    0.6294591         0
#> 2                    0.7011424                    0.6343738         1
#> 3                    0.7005642                    0.6325691         2
#> 4                    0.6997407                    0.6350002         3
#> 5                    0.6988559                    0.6327487         4
#> 6                    0.6979798                    0.6325122         5
#>   edge_path_idx edge_chunk_idx
#> 1             0              0
#> 2             0              0
#> 3             0              0
#> 4             0              0
#> 5             0              0
#> 6             0              0