Lightweight and lazy experiment logging
Project description
Lightweight, lazy experiment logging
lazyscribe
is a lightweight package for model experiment logging. It creates a single JSON
file per project, and an experiment is only added to the file when code finishes (errors won't
result in partially finished experiments in your project log).
lazyscribe
also has functionality to allow for multiple people to work on a single project.
You can merge projects together and update the list of experiments to create a single, authoritative
view of all executed experiments.
Installation
$ python -m pip install lazyscribe
Basic Usage
The basic usage involves instantiating a Project
and using the context manager to log
an experiment:
import json
from lazyscribe import Project
project = Project(fpath="project.json")
with project.log(name="My experiment") as exp:
exp.log_metric("auroc", 0.5)
exp.log_parameter("algorithm", "lightgbm")
You've created an experiment! You can view the experimental data by using list
:
print(json.dumps(list(project), indent=4))
[
{
"name": "My experiment",
"author": "<AUTHOR>",
"last_updated_by": "<AUTHOR>",
"metrics": {
"auroc": 0.5
},
"parameters": {
"algorithm": "lightgbm"
},
"created_at": "<CREATED_AT>",
"last_updated": "<LAST_UPDATED>",
"dependencies": [],
"short_slug": "my-experiment",
"slug": "my-experiment-<CREATED_AT>",
"tests": [],
"artifacts": []
}
]
Once you've finished, save the project to project.json
:
project.save()
Later on, you can read the project back in read-only mode ("r"), append mode ("a"), or editable mode ("w+"):
project = Project("project.json", mode="r")
with project.log(name="New experiment") as exp: # Raises a RuntimeError
...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file lazyscribe-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: lazyscribe-0.6.0-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffd34c2758619af0309e509ffa98f6560fc3f7889df64daa3cba3028a81b6523 |
|
MD5 | 346cb99b3d2332420dc6df9d44e82e4a |
|
BLAKE2b-256 | 6cd7ba711d5a9ac84f0c1dd533eafa0057b27709f83d413763e9c56593870263 |
Provenance
The following attestation bundles were made for lazyscribe-0.6.0-py3-none-any.whl
:
Publisher:
publish-package.yml
on lazyscribe/lazyscribe
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
lazyscribe-0.6.0-py3-none-any.whl
- Subject digest:
ffd34c2758619af0309e509ffa98f6560fc3f7889df64daa3cba3028a81b6523
- Sigstore transparency entry: 145141116
- Sigstore integration time:
- Predicate type: