felixleopoldo / benchpress

A Snakemake workflow to run and benchmark structure learning (a.k.a. causal discovery) algorithms for probabilistic graphical models.
https://benchpressdocs.readthedocs.io
GNU General Public License v2.0
64 stars 17 forks source link

Variable naming convention. #90

Closed melmasri closed 1 year ago

melmasri commented 1 year ago

When running the diffplot method to compare graphs, you have L127 in this here

compares the true graph to the estimated. This throws an error of like

Error in check.nodes(.nodes(custom[[i]]), graph = nodes, min.nodes = length(nodes),  : 
  invalid node(s) 'X0' 'X1' 'X2' 'X3' 'X4' 'X5' 'X6' 'X7' 'X8' 'X9' 'X10' 'X11' 'X12' 'X13' 'X14' 'X15' 'X16' 'X17' 'X18' 'X19' 'X20' 'X21' 'X22' 'X23' 'X24' 'X25' 'X26' 'X27' 'X28' 'X29' 'X30' 'X31' 'X32' 'X33' 'X34' 'X35' 'X36' 'X37' 'X38' 'X39' 'X40' 'X41' 'X42' 'X43' 'X44' 'X45' 'X46' 'X47' 'X48' 'X49' 'X50' 'X51' 'X52' 'X53' 'X54' 'X55' 'X56' 'X57' 'X58' 'X59' 'X60' 'X61' 'X62' 'X63' 'X64' 'X65' 'X66' 'X67' 'X68' 'X69' 'X70' 'X71' 'X72' 'X73' 'X74' 'X75' 'X76' 'X77' 'X78' 'X79' 'X80' 'X81' 'X82' 'X83' 'X84' 'X85' 'X86' 'X87' 'X88' 'X89' 'X90' 'X91' 'X92' 'X93' 'X94' 'X95' 'X96' 'X97' 'X98' 'X99'.
Calls: benchmarks ... graphviz.compare -> check.customlist -> check.nodes
Execution halted

The issue here is that names(pattern_true_bn$nodes) are named [1, 2,3, ....., n] while names(pattern_estimated_bn$nodes) are named [X1, X2, X3, ...] So the file throws and error since the names are not similar.

Here is print of those names

1] "names 1"
  [1] "0"  "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14"
 [16] "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29"
 [31] "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44"
 [46] "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59"
 [61] "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" "73" "74"
 [76] "75" "76" "77" "78" "79" "80" "81" "82" "83" "84" "85" "86" "87" "88" "89"
 [91] "90" "91" "92" "93" "94" "95" "96" "97" "98" "99"
[1] "names 2"
  [1] "X0"  "X1"  "X2"  "X3"  "X4"  "X5"  "X6"  "X7"  "X8"  "X9"  "X10" "X11"
 [13] "X12" "X13" "X14" "X15" "X16" "X17" "X18" "X19" "X20" "X21" "X22" "X23"
 [25] "X24" "X25" "X26" "X27" "X28" "X29" "X30" "X31" "X32" "X33" "X34" "X35"
 [37] "X36" "X37" "X38" "X39" "X40" "X41" "X42" "X43" "X44" "X45" "X46" "X47"
 [49] "X48" "X49" "X50" "X51" "X52" "X53" "X54" "X55" "X56" "X57" "X58" "X59"
 [61] "X60" "X61" "X62" "X63" "X64" "X65" "X66" "X67" "X68" "X69" "X70" "X71"
 [73] "X72" "X73" "X74" "X75" "X76" "X77" "X78" "X79" "X80" "X81" "X82" "X83"
 [85] "X84" "X85" "X86" "X87" "X88" "X89" "X90" "X91" "X92" "X93" "X94" "X95"
 [97] "X96" "X97" "X98" "X99"
melmasri commented 1 year ago

This has been solved, see commit #179c926b178eeb191264f371432a77cf8cee10e5

melmasri commented 1 year ago

see commit above.