added helper function for featurizing a spec

This commit is contained in:
Marcell Vazquez-Chanlatte 2017-10-31 21:14:34 -07:00
parent 75042d0dc4
commit 72639bc59f

13
stl/featurize.py Normal file
View file

@ -0,0 +1,13 @@
from stl.fastboolean_eval import pointwise_sat
def featurize_trace(phi, x):
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):
return pointwise_sat(phi.set_params(vec_to_dict(theta)))(x, 0)
return eval_phi