Skip to content
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

Fix dragon #306

Merged
merged 29 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c419f8c
Merge pull request #1 from netZoo/devel
katehoffshutta Oct 31, 2022
0f801bb
add DRAGON outline
katehoffshutta Nov 4, 2022
fb7d44a
Merge pull request #2 from katehoffshutta/dragon-outline
katehoffshutta Nov 4, 2022
7525029
implemented vars and esqs, added tests
katehoffshutta Nov 9, 2022
6b0dc21
added optim
katehoffshutta Nov 12, 2022
a76aeb2
Merge pull request #3 from katehoffshutta/dragon-r
katehoffshutta Nov 12, 2022
bd05fc2
Added fn to get shrunken cov and unit tests
katehoffshutta Nov 30, 2022
e0cee54
Merge branch 'master' into dragon-r
katehoffshutta Nov 30, 2022
f7d35ca
Merge pull request #4 from katehoffshutta/dragon-r
katehoffshutta Nov 30, 2022
0d82cc3
Update DESCRIPTION
katehoffshutta Nov 30, 2022
9b4eb1f
Update DESCRIPTION
katehoffshutta Nov 30, 2022
046980e
mechanics for prec mat and parcor
katehoffshutta Dec 5, 2022
f1602a2
Merge pull request #5 from katehoffshutta/dragon-r
katehoffshutta Dec 5, 2022
ce31f0f
added testdata directory
katehoffshutta Dec 6, 2022
3c40b95
Merge pull request #6 from katehoffshutta/dragon-r
katehoffshutta Dec 6, 2022
4b586fc
fixed test paths
katehoffshutta Dec 20, 2022
2102d78
Merge pull request #7 from katehoffshutta/dragon-r
katehoffshutta Dec 20, 2022
c2babb7
Update test-dragon.R
katehoffshutta Dec 20, 2022
9d9fb9f
added export function and tests
katehoffshutta Dec 21, 2022
54750cf
updated docs
katehoffshutta Dec 21, 2022
218a9c7
added ex datasets
katehoffshutta Dec 21, 2022
69ba827
Merge branch 'master' into dragon-r
katehoffshutta Dec 21, 2022
bdbe676
Merge pull request #8 from katehoffshutta/dragon-r
katehoffshutta Dec 21, 2022
c4d4dbf
fixed bug w/self-edges in GGM
katehoffshutta Nov 28, 2023
fccfaf8
Merge pull request #9 from katehoffshutta/ggm-diag-fix
katehoffshutta Nov 28, 2023
9a43279
Merge branch 'devel' of https://github.com/netZoo/netZooR into devel
katehoffshutta Nov 28, 2023
dd43ed6
fixed GGM diagonal issue
katehoffshutta Nov 28, 2023
1a207ec
fixed merge conflicts in docs
katehoffshutta Nov 28, 2023
64fbba6
fixed more merge conflicts
katehoffshutta Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions R/DRAGON.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# X_mean = np.mean(X_temp, axis=0)
# return (X_temp - X_mean) / X_std


scale = function(x,bias=FALSE)
{
# sd does 1/(n-1), python does 1/n
Expand Down Expand Up @@ -234,7 +235,7 @@ estimatePenaltyParameters = function(X1,X2)
lower=c(0,0),
upper=c(1,1),
control = list(trace=TRUE,pgtol = 1e-15))

# reparameterize
lambdas = c(1-res$par[1]^2, 1-res$par[2]^2)
return(list("lambdas"=lambdas,"gammas"=res$par,"optim_result"=res,"risk_grid" = riskgrid))
Expand Down Expand Up @@ -296,12 +297,13 @@ get_precision_matrix_dragon = function(X1, X2, lambdas)
# mu = np.mean(X, axis=0)
}


get_partial_correlation_from_precision = function(Theta,selfEdges=FALSE)
{
# by default, does not return self edges (diagonal is set to zero)
ggm = -cov2cor(Theta)
if(!selfEdges)
ggm[diag(ggm)] = 0
diag(ggm) = 0
return(ggm)
}

Expand Down
Loading