def randomEntropyData(seed,N,dag,falsePos=False,falseNeg=False,maxCount=10): random.seed(seed) loc=random.randint(0,N-1) locList=[False for x in range(N)] locList[loc]=True detectable=listOr(dag.anyUpto(locList),locList) counts=[(random.randint(0,maxCount),random.randint(0,maxCount)) for x in range(N)] # eliminate impossible counts for this test if not falsePos: counts=[ cond(not detectable[x],(counts[x][0],0),counts[x]) for x in range(N)] if not falseNeg: counts=[ cond(detectable[x],(0,counts[x][1]),counts[x]) for x in range(N)] UlocPrior=[random.random() for x in range(N)] norm=sum(UlocPrior) locPrior=[numberType.const(i/norm) for i in UlocPrior] return (counts,locPrior)
def randomEntropyData(seed, N, dag, falsePos=False, falseNeg=False, maxCount=10): random.seed(seed) loc = random.randint(0, N - 1) locList = [False for x in range(N)] locList[loc] = True detectable = listOr(dag.anyUpto(locList), locList) counts = [(random.randint(0, maxCount), random.randint(0, maxCount)) for x in range(N)] # eliminate impossible counts for this test if not falsePos: counts = [ cond(not detectable[x], (counts[x][0], 0), counts[x]) for x in range(N) ] if not falseNeg: counts = [ cond(detectable[x], (0, counts[x][1]), counts[x]) for x in range(N) ] UlocPrior = [random.random() for x in range(N)] norm = sum(UlocPrior) locPrior = [numberType.const(i / norm) for i in UlocPrior] return (counts, locPrior)
def skipProbsSimple(skipped,dag): return [listUtils.cond(s,numberType.one,numberType.zero) for s in skipped]