Ejemplo n.º 1
0
 def decodeResult(self, result):
     #accepts the list of [result.boolNames[i] for i in boolnames]
     key = 0
     for i in range(len(self.boolNames)):
         state = statements.get_takeValue(self.boolNames[i])
         if state not in result: continue
         if result[state]: key += 2**i
     return self.item[key]
Ejemplo n.º 2
0
                           [A,B,O,C1,C2,G, L[1],L[2],L[3],L[4],R,C])


outer=[]
def check(classifier,keyStates,num,thr = 0,cnt = -1):
    successes = 0
    for i in range(num):
        smpl = createSample()
        for i in range(len(keyStates)):
            if round(classifier.classify(smpl,thr,cnt)[keyStates[i]]) != keyStates[i].extractValue(smpl):
                    break

        else:successes +=1
    return successes

state0 = statements.get_takeValue('A')
state1 = statements.get_takeValue('B')
state2 = statements.get_takeValue('O')
state3 = statements.get_takeValue('C1')
state4 = statements.get_takeValue('C2')
state5 = statements.get_takeValue('G')
state6 = statements.get_takeValue('L1')
state7 = statements.get_takeValue('L2')
state8 = statements.get_takeValue('L3')
state9 = statements.get_takeValue('L4')
boolStatements = [state2,state3,state4,state5]
numStatements = [state0,state1,state6,state7,state8,state9]

slist = [createSample(1) for i in range(1000)]
numparams= ['A','B','L1','L2','L3','L4']
boolparams = ['O','C1','C2','G']