예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
    def __init__(self, N, rate, dag, multi, loc=None, debug=False):
        self.N = N
        if loc == None:
            self.loc = random.randint(0, N - 1)
        else:
            self.loc = loc
        self.dag = dag
        if rate is None:
            self.rate = random.random()
        else:
            self.rate = rate
        if multi:
            self.multiRates = [random.random() for i in range(N)]
        else:
            self.multiRates = None
        self.tests = 0
        self.locs = []
        self.debug = debug
        self.multi = multi

        locList = [False for x in range(N)]
        locList[self.loc] = True

        self.detectable = listOr(dag.anyUpto(locList), locList)
예제 #4
0
    def __init__(self,N,rate,dag,multi,loc=None,debug=False):
        self.N=N
        if loc==None:
            self.loc=random.randint(0,N-1)
        else:
            self.loc=loc
        self.dag=dag
        if rate is None:
            self.rate=random.random()
        else:            
            self.rate=rate
        if multi:
            self.multiRates=[random.random() for i in range(N)]
        else:
            self.multiRates=None
        self.tests=0
        self.locs=[]
        self.debug=debug
        self.multi=multi

        locList=[False for x in range(N)]
        locList[self.loc]=True

        self.detectable=listOr(dag.anyUpto(locList),locList)