-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dual graph #76
Open
melmasri
wants to merge
32
commits into
master
Choose a base branch
from
dualGraph
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dual graph #76
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0218101
Merge pull request #106 from felixleopoldo/dev
melmasri 7fc6df3
fixing nesting issues
05b9afb
updating sparse config
da57e2e
some fixes
139b3ab
Merge branch 'dualGraph' of https://github.com/felixleopoldo/benchpre…
5267f5d
Update rule.smk
melmasri 4ee9f17
Merge branch 'dualGraph' of https://github.com/felixleopoldo/benchpre…
3a80ede
Merge branch 'dualGraph' of github.com:felixleopoldo/benchpress
melmasri 6b1bbfb
adding radom precmat
4d1cc99
On the way to rand precmat
felixleopoldo ad43840
Fixing pos def problem by increasing diag elements.
felixleopoldo f6c3995
adding delta to jtsampler
603be8b
merge conflict
7c7f129
adding athomar/dualgl
415a8da
updating psi learner
914fd14
adding module strings
47d679e
updating the random matrix
b1009ef
Adding missing info.json files.
felixleopoldo 38aceec
Merge.
felixleopoldo ea89e25
adding confirg for high dim
melmasri 511ebb7
sparse run
melmasri b0cc220
updated the random_precmat.R and dualGL_sparse_randpreci.json files
melmasri 348e12e
Merge branch 'dualGraph' of github.com:felixleopoldo/benchpress into …
melmasri 77dad3f
updating config
melmasri bd466dd
fixing config
melmasri e048e97
updating the random precision
melmasri 2cf9dd1
modified precmat to be autoregressive in distance from diag
melmasri 725da79
adding interclass config
melmasri 2c6d302
bug with json file
melmasri a66e834
adding a small config file
melmasri 3c225c7
adding wishart run
melmasri 13612a3
random percent..
melmasri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
{ | ||
"benchmark_setup": { | ||
"data": [ | ||
{ | ||
"data_id": "example1", | ||
"graph_id": "random-1-ultra-sparse", | ||
"parameters_id": "gwi", | ||
"seed_range": [ | ||
1, | ||
5 | ||
] | ||
}, | ||
{ | ||
"data_id": "example1", | ||
"graph_id": "random-1-sparse", | ||
"parameters_id": "gwi", | ||
"seed_range": [ | ||
1, | ||
5 | ||
] | ||
}, | ||
{ | ||
"data_id": "example1", | ||
"graph_id": "lattice", | ||
"parameters_id": "gwi", | ||
"seed_range": [ | ||
1, | ||
5 | ||
] | ||
}, | ||
{ | ||
"data_id": "example1", | ||
"graph_id": "ar5", | ||
"parameters_id": "gwi", | ||
"seed_range": [ | ||
1, | ||
5 | ||
] | ||
}, | ||
{ | ||
"data_id": "example1", | ||
"graph_id": "circle", | ||
"parameters_id": "gwi", | ||
"seed_range": [ | ||
1, | ||
5 | ||
] | ||
} | ||
], | ||
"evaluation": { | ||
"benchmarks": { | ||
"filename_prefix": "dualGraph_p200_sparse/", | ||
"show_seed": false, | ||
"errorbar": true, | ||
"errorbarh": false, | ||
"scatter": true, | ||
"path": true, | ||
"text": false, | ||
"ids": [ | ||
"dualGL-gt13", | ||
"jtsampler_gts", | ||
"psi-learn", | ||
"glasso", | ||
"mb" | ||
] | ||
}, | ||
"graph_true_plots": true, | ||
"graph_true_stats": false, | ||
"ggally_ggpairs": false, | ||
"graph_plots": [], | ||
"mcmc_traj_plots": [ | ||
{ | ||
"id": "jtsampler_gts", | ||
"burn_in": 0.0, | ||
"thinning": 100, | ||
"functional": [ | ||
"score" | ||
], | ||
"active": true | ||
} | ||
], | ||
"mcmc_heatmaps": [], | ||
"mcmc_autocorr_plots": [] | ||
} | ||
}, | ||
"resources": { | ||
"data": { | ||
"iid": [ | ||
{ | ||
"id": "example1", | ||
"standardized": false, | ||
"n": [ | ||
20, 50, 100 | ||
] | ||
} | ||
] | ||
}, | ||
"graph": { | ||
"trilearn_rand_bandmat": [ | ||
{ | ||
"id": "ar5", | ||
"max_bandwidth": 5, | ||
"dim": 200 | ||
} | ||
], | ||
"bdgraph_graphsim": [ | ||
{ | ||
"id": "random-1-sparse", | ||
"p": 200, | ||
"graph": "random", | ||
"class": null, | ||
"size": null, | ||
"prob": 0.1 | ||
}, | ||
{ | ||
"id": "random-1-ultra-sparse", | ||
"p": 200, | ||
"graph": "random", | ||
"class": null, | ||
"size": null, | ||
"prob": 0.01 | ||
}, | ||
{ | ||
"id": "lattice", | ||
"p": 200, | ||
"graph": "lattice", | ||
"class": null, | ||
"size": null, | ||
"prob": 0.1 | ||
}, | ||
{ | ||
"id": "circle", | ||
"p": 200, | ||
"graph": "circle", | ||
"class": null, | ||
"size": null, | ||
"prob": 0.2 | ||
} | ||
] | ||
}, | ||
"parameters": { | ||
"bdgraph_rgwish": [ | ||
{ | ||
"id": "gwi", | ||
"b": 3, | ||
"threshold_conv": 0.000001 | ||
} | ||
] | ||
}, | ||
"structure_learning_algorithms": { | ||
"equsa_psilearner": [ | ||
{ | ||
"id": "psi-learn", | ||
"timeout": null, | ||
"alpha1": 0.3, | ||
"alpha2": [0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9, 0.98] | ||
|
||
}], | ||
"dualgl": [ | ||
{ | ||
"id": "dualGL-gt13", | ||
"timeout": null, | ||
"startalg": "jtsampler_gts", | ||
"alpha": [0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9, 0.99] | ||
} | ||
], | ||
"athomas_jtsampler": [ | ||
{ | ||
"id": "jtsampler_gts", | ||
"burnin_frac": 0.5, | ||
"mcmc_estimator": ["threshold"], | ||
"timeout": null, | ||
"mcmc_seed": 1, | ||
"num_samples": 10000000, | ||
"sampler": 1, | ||
"edge_penalty": 0.0, | ||
"size_maxclique": 100, | ||
"full_output": true, | ||
"threshold": [ | ||
0.0, | ||
0.1, | ||
0.2, | ||
0.3, | ||
0.4, | ||
0.5, | ||
0.6, | ||
0.7, | ||
0.8, | ||
0.9, | ||
1.0 | ||
] | ||
} | ||
], | ||
"huge_glasso": [ | ||
{ | ||
"id": "glasso", | ||
"lambda": [2, 1, 0.8, 0.6, 0.4, 0.2, 0.1, 0.05, 0.01], | ||
"timeout": null | ||
} | ||
], | ||
"huge_mb": [ | ||
{ | ||
"id": "mb", | ||
"lambda": [2, 1, 0.8, 0.6, 0.4, 0.2, 0.1, 0.05, 0.01], | ||
"timeout": null | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Provides a way to create a precision matrix with entries assigned randomly from a given list. | ||
The genrated precision is then converted to a correlation matrix. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"title": "Random-precision", | ||
"version": "", | ||
"package": { | ||
"title": "", | ||
"url": "" | ||
}, | ||
"docs_url": "", | ||
"papers": [ | ||
], | ||
"graph_types": [ | ||
"UG" | ||
], | ||
"language": "R" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Samples and inverts a precision matrics from the G-Wishart distribution. | ||
|
||
|
||
seed <- as.integer(snakemake@wildcards[["seed"]]) | ||
set.seed(seed) | ||
|
||
df <- read.csv(snakemake@input[["adjmat"]], header = TRUE, check.names = FALSE) | ||
adjmat <- as.matrix(df) | ||
p <- nrow(adjmat) | ||
|
||
K_values <-as.numeric(snakemake@input[['precision_values']]) | ||
|
||
print("Simulating randam-precision matrix") | ||
if(length(K_values) == 1) | ||
{ | ||
precmat <- 1*(adjmat !=0) * K_values | ||
} | ||
|
||
if(length(K_values) > 1) | ||
{ | ||
M = sum(adjmat !=0) | ||
v = sample.int(length(K_values), M, replace=TRUE) | ||
precmat<- 1*(adjmat !=0) | ||
precmat[which(adjmat!=0)] <- K_values[v] | ||
} | ||
|
||
|
||
print("Inverting the precision matrix") | ||
covmat <- cov2cor(solve(precmat)) | ||
colnames(covmat) <- colnames(df) | ||
|
||
filename <- snakemake@output[["params"]] | ||
write.table(covmat, | ||
file = filename, row.names = FALSE, | ||
quote = FALSE, col.names = TRUE, sep = "," | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
rule bdgraph_rgwish: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This name should probably be changed |
||
input: | ||
adjmat = "{output_dir}/adjmat/{adjmat}.csv" | ||
output: | ||
params = "{output_dir}/parameters/" + \ | ||
pattern_strings["random_precmat"] + "/" \ | ||
"seed={seed}/"+\ | ||
"adjmat=/{adjmat}.csv" | ||
container: | ||
None | ||
script: | ||
"random_precmat.R" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"title": "random_precision", | ||
"description": "Generates a random precision matrix", | ||
"type": "array", | ||
"items": { | ||
"title": "random_precision", | ||
"description": "Generates a precision matrix from the given list of values, assigned randomly, then coverts it to a correlation matrix", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"precision_values": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"id", | ||
"precision_values" | ||
], | ||
"additionalProperties": false, | ||
"examples": [ | ||
{ | ||
"id": "rand_K", | ||
"precision_values": [0.5, 0.25] | ||
} | ||
] | ||
}, | ||
"uniqueItems": true | ||
} |
19 changes: 19 additions & 0 deletions
19
workflow/rules/structure_learning_algorithms/athomas_jtsampler/rule.smk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
|
||
def change_filename(original_string): | ||
return original_string.replace("adjvecs_tobecompressed.csv", "adjvecs_fulloutput.tar.gz") | ||
|
||
|
||
rule athomas_jtsampler: | ||
input: | ||
data=alg_input_data(), | ||
output: | ||
seqgraph=touch(alg_output_seqgraph_path(module_name)), | ||
seqgraph_full=touch(change_filename(alg_output_seqgraph_path(module_name))), | ||
time=touch(alg_output_time_path(module_name)), | ||
ntests=touch(alg_output_ntests_path(module_name)) | ||
container: | ||
"docker://hallawalla/athomas_jtsampler:1.5" | ||
script: | ||
"script.sh" | ||
|
40 changes: 40 additions & 0 deletions
40
workflow/rules/structure_learning_algorithms/athomas_jtsampler/script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
#CP=$(pwd)/workflow/rules/structure_learning_algorithms/athomas_jtsampler/jtsampler | ||
CP=/jtsampler | ||
TEMP_FILENAME=${snakemake_output[seqgraph_full]/fulloutput.tar.gz/fulloutput_tobecompressed.csv} | ||
if [ ${snakemake_wildcards[timeout]} = "None" ]; then | ||
if [ ${snakemake_wildcards[full_output]} = "True" ]; then | ||
/usr/bin/time -f "%e" -o ${snakemake_output[time]} java -classpath $CP EstimateGM \ | ||
-r ${snakemake_wildcards[mcmc_seed]} \ | ||
-n ${snakemake_wildcards[num_samples]} \ | ||
-s ${snakemake_wildcards[sampler]} \ | ||
-a ${snakemake_wildcards[edge_penalty]} \ | ||
-c ${snakemake_wildcards[size_maxclique]} \ | ||
-pd 5 \ | ||
-F < ${snakemake_input[data]} > $TEMP_FILENAME | ||
## convet to benchpress file | ||
## copying the first 4 lines and every line afterwards that has a successfull move | ||
awk -F, -v OFS=',' 'NR <= 4 || $5 == 0 {print $1, $2, $3, $4}' $TEMP_FILENAME > ${snakemake_output[seqgraph]} | ||
## compressing the files | ||
tar -czf ${snakemake_output[seqgraph_full]} $TEMP_FILENAME | ||
rm -f $TEMP_FILENAME | ||
else | ||
/usr/bin/time -f "%e" -o ${snakemake_output[time]} java -classpath $CP EstimateGM \ | ||
-r ${snakemake_wildcards[mcmc_seed]} \ | ||
-n ${snakemake_wildcards[num_samples]} \ | ||
-s ${snakemake_wildcards[sampler]} \ | ||
-a ${snakemake_wildcards[edge_penalty]} \ | ||
-pd 5 \ | ||
-c ${snakemake_wildcards[size_maxclique]} < ${snakemake_input[data]} > ${snakemake_output[seqgraph]} | ||
fi | ||
else | ||
/usr/bin/time -f "%e" -o ${snakemake_output[time]} timeout -s SIGINT ${snakemake_wildcards[timeout]} bash -c 'java -classpath $CP EstimateGM -r ${snakemake_wildcards[mcmc_seed]} < ${snakemake_input[data]} > ${snakemake_output[seqgraph]}' | ||
fi | ||
|
||
|
||
|
||
|
||
|
||
|
||
#java -classpath $CP EstimateGM -r 1 -n 1000 -s 2 -a 10000 < results/data/adjmat\=/bdgraph_graphsim/p\=25/graph\=random/class\=None/size\=None/prob\=0.5/seed\=1/parameters\=/bdgraph_rgwish/b\=3/threshold_conv\=1e-07/seed\=1/data\=/iid/n\=100/seed\=1.csv |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a rule in the iiid data module, telling how to sample from this. It will probably be in the sam way as for the intra class parameters module.