def __init__(self, df, penaltydiscount=4, maxDegree=3, faithfulnessAssumed=True, numofthreads=2, verbose=False, priorKnowledge=None): tetradData = pycausal.loadContinuousData(df) score = javabridge.JClassWrapper('edu.cmu.tetrad.search.SemBicScore')( tetradData) score.setPenaltyDiscount( penaltydiscount ) # set to 2 if variable# <= 50 otherwise set it to 4 fgs = javabridge.JClassWrapper('edu.cmu.tetrad.search.Fgs')(score) fgs.setMaxDegree(maxDegree) fgs.setNumPatternsToStore(0) fgs.setFaithfulnessAssumed(faithfulnessAssumed) fgs.setParallelism(numofthreads) fgs.setVerbose(verbose) if priorKnowledge is not None: fgs.setKnowledge(priorKnowledge) tetradGraph = fgs.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph) self.graph = pycausal.generatePyDotGraph(self.nodes, self.edges)
def __init__(self, df, continuous=True, depth=3, aggressivelyPreventCycles=False, significance=0.05, verbose=False, priorKnowledge=None): indTest = None if (continuous): tetradData = pycausal.loadContinuousData(df) indTest = javabridge.JClassWrapper( 'edu.cmu.tetrad.search.IndTestFisherZ')(tetradData, significance) else: tetradData = pycausal.loadDiscreteData(df) indTest = javabridge.JClassWrapper( 'edu.cmu.tetrad.search.IndTestChiSquare')(tetradData, significance) cpcstable = javabridge.JClassWrapper( 'edu.cmu.tetrad.search.CpcStable')(indTest) cpcstable.setDepth(depth) cpcstable.setAggressivelyPreventCycles(aggressivelyPreventCycles) cpcstable.setVerbose(verbose) if priorKnowledge is not None: cpcstable.setKnowledge(priorKnowledge) tetradGraph = cpcstable.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph) self.graph = pycausal.generatePyDotGraph(self.nodes, self.edges)
def __init__(self, df, continuous=True, depth=3, significance=0.05, verbose=False, priorKnowledge=None): indTest = None if (continuous): tetradData = pycausal.loadContinuousData(df) indTest = javabridge.JClassWrapper( 'edu.cmu.tetrad.search.IndTestFisherZ')(tetradData, significance) else: tetradData = pycausal.loadDiscreteData(df) indTest = javabridge.JClassWrapper( 'edu.cmu.tetrad.search.IndTestChiSquare')(tetradData, significance) ccd = javabridge.JClassWrapper('edu.cmu.tetrad.search.Ccd')(indTest) ccd.setDepth(depth) ccd.setVerbose(verbose) if priorKnowledge is not None: ccd.setKnowledge(priorKnowledge) tetradGraph = ccd.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph)
def __init__(self, df, continuous = True, depth = 3, significance = 0.05, verbose = False, priorKnowledge = None): indTest = None if(continuous): tetradData = pycausal.loadContinuousData(df) indTest = javabridge.JClassWrapper('edu.cmu.tetrad.search.IndTestFisherZ')(tetradData, significance) else: tetradData = pycausal.loadDiscreteData(df) indTest = javabridge.JClassWrapper('edu.cmu.tetrad.search.IndTestChiSquare')(tetradData, significance) ccd = javabridge.JClassWrapper('edu.cmu.tetrad.search.Ccd')(indTest) ccd.setDepth(depth) ccd.setVerbose(verbose) if priorKnowledge is not None: ccd.setKnowledge(priorKnowledge) tetradGraph = ccd.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph)
def __init__(self, df, penaltydiscount = 4, maxDegree = 3, faithfulnessAssumed = True, numofthreads = 2, verbose = False, priorKnowledge = None): tetradData = pycausal.loadContinuousData(df) score = javabridge.JClassWrapper('edu.cmu.tetrad.search.SemBicScore')(tetradData) score.setPenaltyDiscount(penaltydiscount) # set to 2 if variable# <= 50 otherwise set it to 4 fges = javabridge.JClassWrapper('edu.cmu.tetrad.search.Fgs')(score) fges.setMaxDegree(maxDegree) fges.setNumPatternsToStore(0) fges.setFaithfulnessAssumed(faithfulnessAssumed) fges.setParallelism(numofthreads) fges.setVerbose(verbose) if priorKnowledge is not None: fges.setKnowledge(priorKnowledge) tetradGraph = fges.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph) self.graph = pycausal.generatePyDotGraph(self.nodes,self.edges)
def __init__(self, df, penaltydiscount = 2, maxInDegree = 3, maxPathLength = -1, significance = 0.05, completeRuleSetUsed = False, faithfulnessAssumed = True, verbose = False, priorKnowledge = None): tetradData = pycausal.loadContinuousData(df) indTest = javabridge.JClassWrapper('edu.cmu.tetrad.search.IndTestFisherZ')(tetradData, significance) score = javabridge.JClassWrapper('edu.cmu.tetrad.search.SemBicScore')(tetradData) score.setPenaltyDiscount(penaltydiscount) # set to 2 if variable# <= 50 otherwise set it to 4 gfci = javabridge.JClassWrapper('edu.cmu.tetrad.search.GFci')(indTest, score) gfci.setMaxIndegree(maxInDegree) gfci.setMaxPathLength(maxPathLength) gfci.setCompleteRuleSetUsed(completeRuleSetUsed) gfci.setFaithfulnessAssumed(faithfulnessAssumed) gfci.setVerbose(verbose) if priorKnowledge is not None: gfci.setKnowledge(priorKnowledge) tetradGraph = gfci.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph)
def __init__(self, df, continuous = True, depth = 3, aggressivelyPreventCycles = False, significance = 0.05, verbose = False, priorKnowledge = None): indTest = None if(continuous): tetradData = pycausal.loadContinuousData(df) indTest = javabridge.JClassWrapper('edu.cmu.tetrad.search.IndTestFisherZ')(tetradData, significance) else: tetradData = pycausal.loadDiscreteData(df) indTest = javabridge.JClassWrapper('edu.cmu.tetrad.search.IndTestChiSquare')(tetradData, significance) cpcstable = javabridge.JClassWrapper('edu.cmu.tetrad.search.CpcStable')(indTest) cpcstable.setDepth(depth) cpcstable.setAggressivelyPreventCycles(aggressivelyPreventCycles) cpcstable.setVerbose(verbose) if priorKnowledge is not None: cpcstable.setKnowledge(priorKnowledge) tetradGraph = cpcstable.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph) self.graph = pycausal.generatePyDotGraph(self.nodes,self.edges)
def __init__(self, df, penaltydiscount=2, maxInDegree=3, maxPathLength=-1, significance=0.05, completeRuleSetUsed=False, faithfulnessAssumed=True, verbose=False, priorKnowledge=None): tetradData = pycausal.loadContinuousData(df) indTest = javabridge.JClassWrapper( 'edu.cmu.tetrad.search.IndTestFisherZ')(tetradData, significance) score = javabridge.JClassWrapper('edu.cmu.tetrad.search.SemBicScore')( tetradData) score.setPenaltyDiscount( penaltydiscount ) # set to 2 if variable# <= 50 otherwise set it to 4 gfci = javabridge.JClassWrapper('edu.cmu.tetrad.search.GFci')(indTest, score) gfci.setMaxIndegree(maxInDegree) gfci.setMaxPathLength(maxPathLength) gfci.setCompleteRuleSetUsed(completeRuleSetUsed) gfci.setFaithfulnessAssumed(faithfulnessAssumed) gfci.setVerbose(verbose) if priorKnowledge is not None: gfci.setKnowledge(priorKnowledge) tetradGraph = gfci.search() self.nodes = pycausal.extractTetradGraphNodes(tetradGraph) self.edges = pycausal.extractTetradGraphEdges(tetradGraph)