record-kit
A simple record toolkit generating human-readable data record in experiments.
Installation
pip install record-kit
Usage
Suppose you have an experiment script like this:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float)
args = parser.parse_args()
def train_ml_model():
for i in range(2):
epoch, loss, acc = i, 0.1, 0.5
Using record-kit to track these generated data is quite easy:
from record_kit import Recorder, Record # use Recorder to track experiment data
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float, default=0.1)
args = parser.parse_args()
def train_ml_model():
for i in range(2):
epoch, loss, acc = i, 0.1, 0.5
recorder.add_data(epoch, loss, acc) # save data
# init Recorder
recorder = Recorder() # init Recorder
recorder.set_meta(args) # save arguments like hyperparameters
recorder.set_header('epoch', 'loss', 'acc') # specify table header
# parse record
record = Record(recorder) # or record = Record('path/to/record')
print(record.meta)
print(record.data)
output
{'lr': 0.1}
epoch loss acc
0 0.0 0.10 0.5
1 1.0 0.08 0.9
generated record in ./records/record-timestamp.md
Record Format
A typical record includes two sections Meta and Data.
# record-20201020-154912
## Meta
| key | value | type |
| :---: | :---: | :---: |
| lr | 0.1 | float |
## Data
| epoch | loss | acc |
| :---: | :---: | :---: |
| 0 | 0.1 | 0.5 |
| 1 | 0.08 | 0.9 |
API
Recorder
Recorder(file_name='record', records_dir='./records', with_timestamp=True)
Initialize a Recorder instance
Recorder.set_meta(dict_like_object)
Add meta info to the record. Note meta info can only be added once.
You may use dict or argparse.Namespace(return type of parser.parse_args()) as its parameter.
Recorder.set_header(*args)
Specify header of data table in Data section. The header can only be added once.
Recorder.add(*args)
Add a data line to the table in Data section.
The number of parameters in should be consistent with Recorder.set_header(*args)
Record
Record(Recorder_or_path_str)
Load & parse record
Record.meta -> dict
Get meta info of record.
Record.data -> pandas.DataFrame
Get data table of record.
Metadata
Release files for record-kit 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| record_kit-0.1.10-py3-none-any.whl | Python 3 | none | any | Details for record_kit-0.1.10-py3-none-any.whl |
Release files / record_kit-0.1.10-py3-none-any.whl
| Download URL | record_kit-0.1.10-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e5cfc61dfeb11c5dce0db2a8dd655d762710e5a363116875470721189217ff1
|
|
BLAKE2b-256 checksum How to use checksums |
e1768fc0f2baf89024e3daf43f023f73e5b6f02aae605022bea3c0aeba259d07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Security for record-kit 0.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.