payed off testing technical debt + bug fixes + traces based evaluator

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-11-11 17:35:48 -08:00
parent 72639bc59f
commit cba8a83c8e
12 changed files with 302 additions and 172 deletions

View file

@ -1,13 +1,14 @@
from stl.fastboolean_eval import pointwise_sat
from stl import pointwise_sat
def featurize_trace(phi, x):
def ordered_evaluator(phi):
params = {ap.name for ap in phi.params}
order = tuple(params)
def vec_to_dict(theta):
return {k: v for k, v in zip(order, theta)}
def eval_phi(theta):
def eval_phi(theta, x):
return pointwise_sat(phi.set_params(vec_to_dict(theta)))(x, 0)
return eval_phi
return eval_phi, order