-
Notifications
You must be signed in to change notification settings - Fork 19
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
no pcmax implementation in bd2kccd/r-causal #28
Comments
... which is strange because I see it here: https://github.com/bd2kccd/r-causal/blob/master/java/edu/cmu/tetrad/search/PcMax.java |
We've seen instances where the a recent R library is not loaded unless the old one is explicitly unloaded. You may want to try that.
See this thread
#23
… On Feb 15, 2017, at 10:23 AM, Kingfish Threesevens ***@***.***> wrote:
... which is strange because I see it here: https://github.com/bd2kccd/r-causal/blob/master/java/edu/cmu/tetrad/search/PcMax.java
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Nope. Still not working. Detached, removed rcausal installations, library(devtools)/install_github'd, still no success (in seeing pcmax). |
Scott, We don't currently support pcmax in the r-causal library yet. I'll put it in the next release. I'll notify you when it's done. In the mean time, you can use pcmax in the Tetrad application http://www.phil.cmu.edu/tetrad/. Regards, Kong |
Hi Chiyaru,
That's alright. I went ahead and wrote a wrapper for it and am debugging it (of course, in order to test it, NAMESPACE and INDEX in main folder have to be updated). I am testing it now.
…--S
############
pcmax <- function(df, continuous = TRUE, depth = 3,
#aggressivelyPreventCycles = FALSE,
falseDiscoveryRate = FALSE, significance = 0.05, #maxPathLength = NULL,
#useHeuristic = FALSE,
verbose = FALSE, java.parameters = NULL, priorKnowledge = NULL) {
params <- list(NULL)
if(!is.null(java.parameters)){
options(java.parameters = java.parameters)
params <- c(java.parameters = java.parameters)
}
# Data Frame to Independence Test
indTest = NULL
if(continuous){
tetradData <- loadContinuousData(df)
indTest <- .jnew("edu/cmu/tetrad/search/IndTestFisherZ", tetradData, significance)
}else{
tetradData <- loadDiscreteData(df)
indTest <- .jnew("edu/cmu/tetrad/search/IndTestChiSquare", tetradData,
significance)
}
indTest <- .jcast(indTest, "edu/cmu/tetrad/search/IndependenceTest")
pcmax <- list()
class(pcmax) <- "pcmax"
pcmax$datasets <- deparse(substitute(df))
cat("Datasets:\n")
cat(deparse(substitute(df)),"\n\n")
# Initiate PC
pcmax_instance <- .jnew("edu/cmu/tetrad/search/PcMax", indTest)
.jcall(pcmax_instance, "V", "setDepth", as.integer(depth))
#.jcall(pcmax_instance, "V", "setMaxPathLength", as.integer(maxPathLength))
# .jcall(pcmax_instance, "V", "setUseHeuristic", useHeuristic)
.jcall(pcmax_instance, "V", "setVerbose", verbose)
if(!is.null(priorKnowledge)){
.jcall(pcmax_instance, "V", "setKnowledge", priorKnowledge)
}
params <- c(params, continuous = continuous)
params <- c(params, depth = as.integer(depth))
# params <- c(params, aggressivelyPreventCycles = as.logical(aggressivelyPreventCycles))
# params <- c(params, falseDiscoveryRate = as.logical(falseDiscoveryRate))
params <- c(params, significance = significance)
# params <- c(params, maxPathLength = as.integer(maxPathLength))
# params <- c(params, useHeuristic = as.logical(useHeuristic))
params <- c(params, verbose = as.logical(verbose))
if(!is.null(priorKnowledge)){
params <- c(params, prior = priorKnowledge)
}
pcmax$parameters <- params
cat("Graph Parameters:\n")
cat("continuous = ", continuous, "\n")
cat("depth = ", as.integer(depth),"\n")
# cat("aggressivelyPreventCycles = ", aggressivelyPreventCycles, "\n")
# cat("falseDiscoveryRate = ", falseDiscoveryRate, "\n")
cat("significance = ", as.integer(significance), "\n")
cat("verbose = ", verbose, "\n")
# cat("maxPathLength = ", as.integer(maxPathLength), "\n")
# cat("useHeuristic = ", useHeuristic, "\n")
# Search
tetrad_graph <- .jcall(pcmax_instance, "Ledu/cmu/tetrad/graph/Graph;",
"search")
V <- extractTetradNodes(tetrad_graph)
pcmax$nodes <- V
# extract edges
pcmax_edges <- extractTetradEdges(tetrad_graph)
pcmax$edges <- pcmax_edges
# convert output of PC into an R object (graphNEL)
pcmax_graphNEL = tetradPattern2graphNEL(resultGraph = tetrad_graph,
verbose = verbose)
pcmax$graphNEL <- pcmax_graphNEL
return(pcmax)
}
________________________________
From: Chirayu (Kong) Wongchokprasitti <[email protected]>
Sent: Wednesday, February 15, 2017 12:36 PM
To: bd2kccd/r-causal
Cc: Malec, Scott A; Author
Subject: Re: [bd2kccd/r-causal] no pcmax implementation in bd2kccd/r-causal (#28)
Scott,
We don't currently support pcmax in the r-causal library yet. I'll put it in the next release. I'll notify you when it's done. In the mean time, you can use pcmax in the Tetrad application http://www.phil.cmu.edu/tetrad/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.phil.cmu.edu_tetrad_&d=DQMFaQ&c=6vgNTiRn9_pqCD9hKx9JgXN1VapJQ8JVoF8oWH1AgfQ&r=cJocORfYogykfmw40_PYbTR-_FlW5GZ15C5SG7IuxyE&m=sPSo1aFWOy5la4OwC_uzcEUJRPqfpsyqW303WMHeEyg&s=HpfbDpLoUfMWnYPsv8em3NqfB1ntzvXSQLkAvaM5N6o&e=>.
Regards,
Kong
-
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_bd2kccd_r-2Dcausal_issues_28-23issuecomment-2D280098127&d=DQMFaQ&c=6vgNTiRn9_pqCD9hKx9JgXN1VapJQ8JVoF8oWH1AgfQ&r=cJocORfYogykfmw40_PYbTR-_FlW5GZ15C5SG7IuxyE&m=sPSo1aFWOy5la4OwC_uzcEUJRPqfpsyqW303WMHeEyg&s=QhV4WSxGIX1YW0Ksttgpax7tOpCFHGg1wG4rQ-ofI4Q&e=>, or mute the thread<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ACh2SGWMlqcC-5FUMlXnfqDk3Lbr9xJziLks5rc0WbgaJpZM4MBWVv&d=DQMFaQ&c=6vgNTiRn9_pqCD9hKx9JgXN1VapJQ8JVoF8oWH1AgfQ&r=cJocORfYogykfmw40_PYbTR-_FlW5GZ15C5SG7IuxyE&m=sPSo1aFWOy5la4OwC_uzcEUJRPqfpsyqW303WMHeEyg&s=Z3EuNQLsAZGY61Yo5VprEehRN5GkOyPoFWvpJoXnwlg&e=>.
|
Thanks, Scott. :-) Anyway, the pcmax was added. If you have a chance, please check the new library out. |
Greetings,
Please put a means to implement pcmax in r-causal. I am performing randomized sub-sampling of millions of rows/observations (and between 20 to 30K+ discrete binary variables) and I am going to do an alpha = .000005. I will be looking for stable edges across samples.
Thanks!
Scott
The text was updated successfully, but these errors were encountered: