def create_pttr_vmo(oracle, pattern): thresh = oracle.params['threshold'] _vmo_vec = [] gesture_vmo_vec = [] for p in pattern: _vmo_vec.append([]) for sfx in p[0]: local_obs = oracle.f_array[sfx - p[1] + 1:sfx + 1] local_vmo = build_oracle(local_obs, flag='a', threshold=thresh) _vmo_vec[-1].append(local_vmo) pttr_vmo = _vmo_vec[-1][0] for i in range(pttr_vmo.n_states - 1): for mo in _vmo_vec[-1][1:]: pttr_vmo.trn[i].extend(set(mo.trn[i]).difference(pttr_vmo.trn[i])) gesture_vmo_vec.append(pttr_vmo) return gesture_vmo_vec
def create_reverse_oracle(oracle): reverse_data = oracle.f_array[-1:0:-1] r_oracle = build_oracle(reverse_data, 'v', threshold=oracle.params['threshold']) return r_oracle
def build_oracle_test(self): p = build_oracle(SYMBOLIC_SEQ, 'f') self.assertEqual([0, 0, 0, 1, 0, 1, 2, 2, 0, 1, 2, 3], p.lrs) self.assertEqual([None, 0, 0, 2, 0, 1, 2, 4, 0, 1, 2, 7], p.sfx)