Old engine for Continuous Time Bayesian Networks. Superseded by reCTBN. 🐍
https://github.com/madlabunimib/PyCTBN
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
655 B
28 lines
655 B
from functools import wraps
|
|
from time import time
|
|
|
|
def timing(f):
|
|
@wraps(f)
|
|
def wrap(*args, **kw):
|
|
ts = time()
|
|
result = f(*args, **kw)
|
|
te = time()
|
|
print (f"{f.__name__} args:[{args},{kw}] took: {te-ts} sec")
|
|
|
|
return result
|
|
return wrap
|
|
|
|
|
|
def timing_write(f):
|
|
@wraps(f)
|
|
def wrap(*args, **kw):
|
|
ts = time()
|
|
result = f(*args, **kw)
|
|
te = time()
|
|
print (f"{f.__name__} args:[{args},{kw}] took: {te-ts} sec")
|
|
|
|
with open("../results/results.csv", 'a+') as fi:
|
|
fi.write(f"\n{round(te-ts,3)},")
|
|
|
|
return result
|
|
return wrap |