added helper function for featurizing a spec
This commit is contained in:
parent
75042d0dc4
commit
72639bc59f
1 changed files with 13 additions and 0 deletions
13
stl/featurize.py
Normal file
13
stl/featurize.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue