-
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 1 commit
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
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 | ||
} |
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.