Log non-global metrics¶
Sometimes, it’s helpful to log non-global metrics to an experimenent. To do so, create a
lazyscribe.test.Test using lazyscribe.experiment.Experiment.log_test():
from lazyscribe import Project
project = Project(fpath="project.json", mode="w")
with project.log(name="My experiment") as exp:
with exp.log_test(name="My test", description="Demo test") as test:
test.log_metric("metric", 0.3)
test.log_parameter("param", "value")
The test’s parameter has been also stored here.
The lazyscribe.experiment.Experiment.log_test() context handler creates a lazyscribe.test.Test object and
logs it back to the experiment when the handler exits. If you want to avoid using the context
handler, instantiate your own test and append it to the lazyscribe.experiment.Experiment.tests list:
from lazyscribe import Test
with project.log(name="My experiment") as exp:
test = Test(name="My test", description="Demo test")
test.log_metric("metric", 0.3)
exp.tests.append(test)