Skip to content

Commit 5a43979

Browse files
felixleopoldomelmasriMohamad
authored
Dev (#96)
* Adding functionality for nesting algorithms (#84) * Fixing the input graph feature. * ON the input graph feature. * Passing seed number to the tetrad modules. * Adding discrete data examples for boss and grasp. * Fixing boss and grasp json schemas. * Added test for grasp. * Updating docs and conf. * Fixed bug in benchpress module when empty graph files are written. --------- Co-authored-by: Mohamad Elmasri <[email protected]> Co-authored-by: Mohamad <mo@julia>
1 parent 423ce41 commit 5a43979

File tree

5 files changed

+20
-29
lines changed

5 files changed

+20
-29
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.0
1+
2.5.0

docs/source/index.rst

+3-14
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
available_structure_learning_algorithms
3636
available_evaluations
3737

38-
3938
.. toctree::
4039
:hidden:
4140
:maxdepth: 1
@@ -44,14 +43,6 @@
4443

4544
module_add
4645

47-
.. .. toctree::
48-
.. :hidden:
49-
.. :maxdepth: 3
50-
.. :name: File formats
51-
.. :caption: File formats
52-
53-
.. data_formats
54-
5546
.. toctree::
5647
:hidden:
5748
:maxdepth: 3
@@ -71,12 +62,10 @@
7162

7263
------------------------
7364

74-
7565
##################################
7666
Benchpress
7767
##################################
7868

79-
8069
Describing the relationship between the variables in a study domain and modelling
8170
the data generating mechanism is a fundamental problem in many empirical sciences.
8271
`Probabilistic graphical models <https://en.wikipedia.org/wiki/Graphical_model>`_ are one common approach to tackle the problem.
@@ -97,12 +86,12 @@ generated datasets, the workflow also includes a number of standard datasets and
9786
* The paper :footcite:t:`rios2021benchpress`
9887
* The `GitHub <https://github.com/felixleopoldo/benchpress>`_ repository
9988
* This `Medium story <https://medium.com/@felixleopoldorios/structure-learning-using-benchpress-826847db0aa8>`_
100-
* This tutorial `UAI 2023 Tutorial: Structure Learning Using Benchpress - YouTube <https://www.youtube.com/watch?v=tx3hIH3b9Hg>`_
101-
* The `Discord <https://discord.com/channels/1007933286724685824/1007933287215411284>`_ chat for any kind of questions
102-
89+
* This video tutorial `UAI 2023 Tutorial: Structure Learning Using Benchpress - YouTube <https://www.youtube.com/watch?v=tx3hIH3b9Hg>`_
90+
* The `Discord <https://discord.com/channels/1007933286724685824/1007933287215411284>`_ chat for any kind of discussions etc.
10391

10492
.. rubric:: Updates
10593

94+
* 2023-10-13: Benchpress 2.5.0 released. Added the feature to pass the graph estimate of one algorithm as input of another. Added the algorithm module :ref:`athomas_jtsamplers` for MCMC estimating graphs of undirected decomposable graphical models.
10695
* 2023-09-24: Benchpress 2.4.0 released. Added the Psi-learner algorithm for learning graphs of undirected Gaussian graphical models (:ref:`equsa_psilearner`).
10796
* 2023-09-19: Benchpress 2.3.0 released. Updated causal-cmd to version 1.10.0. Added the BOSS algorithm (:ref:`tetrad_boss`).
10897
* 2023-09-08: Benchpress 2.2.0 released. Now supporting the `ARM64 <https://en.wikipedia.org/wiki/AArch64>`_ architecture used e.g. by the recent Apple computers.

workflow/rules/data/iid/rules.smk

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ rule sample_bin_bn_data:
88
output:
99
data="{output_dir}/data" \
1010
"/adjmat=/{adjmat}"\
11-
"/parameters=/bin_bn/{bn}"\
11+
"/parameters=/bin_bn/{bn}"\
1212
"/data=/"+pattern_strings["iid"] + "/" \
1313
"seed={replicate}.csv"
1414
wildcard_constraints:
@@ -107,7 +107,7 @@ rule sample_data_fixed_bnfit:
107107
data="{output_dir}/data/adjmat=/{adjmat}/parameters=/bn.fit_networks/{bn}/data=/"+pattern_strings["iid"]+"/seed={replicate}.csv"
108108
wildcard_constraints:
109109
n="[0-9]*",
110-
bn=".*\.rds"
110+
bn=".*\.rds"
111111
shell:
112112
"Rscript workflow/rules/data/iid/sample_from_bnlearn_bn.R " \
113113
"--filename {output.data} " \

workflow/rules/evaluation/benchmarks/path_generators.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def summarise_alg_input_adjmat_est_path(algorithm):
3333
"adjmat=/{adjmat}/"\
3434
"parameters=/{bn}/"\
3535
"data=/{data}/"\
36-
"algorithm=/" + pattern_strings[algorithm] + "/" + \
36+
"algorithm=/" + pattern_strings[algorithm] + "/" \
3737
"seed={replicate}/" \
3838
"adjmat.csv"
3939

@@ -42,7 +42,7 @@ def summarise_alg_input_time_path(algorithm):
4242
"adjmat=/{adjmat}/"\
4343
"parameters=/{bn}/"\
4444
"data=/{data}/" \
45-
"algorithm=/" + pattern_strings[algorithm] + "/" + \
45+
"algorithm=/" + pattern_strings[algorithm] + "/" \
4646
"seed={replicate}/" \
4747
"time.txt"
4848

@@ -52,13 +52,13 @@ def summarise_alg_input_ntests_path(algorithm):
5252
"adjmat=/{adjmat}/"\
5353
"parameters=/{bn}/"\
5454
"data=/{data}/" \
55-
"algorithm=/" + pattern_strings[algorithm] + "/" + \
55+
"algorithm=/" + pattern_strings[algorithm] + "/" \
5656
"seed={replicate}/" \
5757
"ntests.txt"
5858

5959
def summarise_alg_output_res_path(algorithm):
6060
return "{output_dir}/result/"\
61-
"algorithm=/" + pattern_strings[algorithm] + "/" + \
61+
"algorithm=/" + pattern_strings[algorithm] + "/" \
6262
"adjmat=/{adjmat}/"\
6363
"parameters=/{bn}/"\
6464
"data=/{data}/"\

workflow/rules/evaluation/benchmarks/plot_ROC.R

+10-8
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ fpr_tpr_pattern <- function(){
6161
)
6262
}
6363
} + {
64-
6564
if (!param_annot) {
6665
geom_point(
6766
data = toplot, alpha = 0.5,
@@ -84,7 +83,7 @@ fpr_tpr_pattern <- function(){
8483
col = id_numlev
8584
), shape = 20,
8685
size = 1
87-
)
86+
)
8887
}
8988
} + {
9089
if (scatter && show_seed) {
@@ -106,7 +105,7 @@ fpr_tpr_pattern <- function(){
106105
replace_na(list("curve_vals" = 0)) %>%
107106
mutate(SHDP_pattern_median = 1 - TPR_pattern_median + FPRn_pattern_median) %>%
108107
filter(SHDP_pattern_median == min(SHDP_pattern_median)),
109-
alpha = 0.8, position = "dodge", alpha = 1, show.legend = FALSE,
108+
alpha = 0.8, position = "dodge", show.legend = FALSE,
110109
aes(
111110
x = FPRn_pattern_median, y = TPR_pattern_median,
112111
col = id_numlev, label = id_num
@@ -126,7 +125,7 @@ fpr_tpr_pattern <- function(){
126125
)
127126
}
128127
} +
129-
guides(shape = FALSE) +
128+
guides(shape = "none") +
130129
facet_wrap(. ~ adjmat + parameters + data + n_seeds, nrow = 2) +
131130
{
132131
if (!is.null(xlim)) {
@@ -929,9 +928,12 @@ if (file.info(snakemake@input[["csv"]])$size == 0) {
929928
toplot <- read.csv(snakemake@input[["csv"]]) # Median, mean, quantiles, taken over the seeds
930929
joint_bench <- read.csv(snakemake@input[["raw_bench"]]) # All raw benchmarks in one dataframe
931930

932-
replacement_list <- list(parameters = "NA") # converts NA to string "NA" in the dataframe
933-
toplot[is.na(toplot)] <- "NA"
934-
joint_bench[is.na(joint_bench)] <- "NA"
931+
# ME: converting NA to sting causes mix types in a column
932+
# R in this case converts all to string
933+
# made an laternative fix below
934+
# replacement_list <- list(parameters = "NA") # converts NA to string "NA" in the dataframe
935+
# toplot[is.na(toplot)] <- "NA"
936+
# joint_bench[is.na(joint_bench)] <- "NA"
935937
#toplot <- toplot %>% replace_na(replacement_list)
936938
#joint_bench <- joint_bench %>% replace_na(replacement_list)
937939

@@ -997,7 +999,7 @@ if (file.info(snakemake@input[["csv"]])$size == 0) {
997999
filter(adjmat == adjmat2) %>%
9981000
filter(parameters == parameters2) %>%
9991001
filter(data == data2)
1000-
1002+
10011003
if (nrow(joint_bench) > 0) {
10021004
fpr_tpr_pattern()
10031005
fpr_tpr_skel()

0 commit comments

Comments
 (0)