Skip to main content

Experiment Logger

Project description

ExpLog - A Minimal Experiment Logger

Installation

pip install explog

Then, import explog as xl.

Logging

Use exp = xl.exp(config) to initialize an experiment and exp.log(...) to log statistics.

import explog as xl
import random

config = {'num_epochs': 100, 'learning_rate': 1e-3, 'batch_size': 32}

exp = xl.exp(config)

for epoch in range(config['num_epochs']):
    loss = random.random() * 1.05 ** (- epoch)
    exp.log(epoch=epoch, loss=loss)
  • NB: Using xl.log(...) instead of exp.log(...) automatically logs to the latest experiment.
  • NB: Both xl.exp(...) and xl.log(...) accept dictionary or kwargs arguments.

Exploring runs

Retrieve dataframe of experiments using xl.exps().

> xl.exps()
          num_epochs  learning_rate  batch_size
_id
w1gf6deg         100          0.001          32
6mwn9cno         100          0.001          32
hdakmy0l         100          0.001          32

Exploring logs

Retrieve dataframe of logs using xl.logs().

> xl.logs()
                epoch      loss  num_epochs  learning_rate  batch_size
_id      _step
w1gf6deg 0          0  0.901695         100          0.001          32
         1          1  0.676328         100          0.001          32
         2          2  0.194963         100          0.001          32
         3          3  0.345743         100          0.001          32
         4          4  0.645544         100          0.001          32
...               ...       ...         ...            ...         ...
hdakmy0l 95        95  0.003342         100          0.001          32
         96        96  0.000132         100          0.001          32
         97        97  0.003763         100          0.001          32
         98        98  0.008314         100          0.001          32
         99        99  0.004589         100          0.001          32

Plotting

Use dataframe of logs from xl.logs() to make your plots.

import explog as xl
import matplotlib.pyplot as plt

logs = xl.logs('epoch', 'loss')
logs = logs.groupby('epoch').mean()

plt.plot(logs.index, logs['loss'])
plt.show()

Weights & Biases users

Use aliases run = xl.init(config) for exp = xl.exp(config) and xl.runs for xl.exps.

> run = xl.init(config)
> run.log(step=0)
> xl.runs()
          num_epochs  learning_rate  batch_size
_id
z5y6tdm5         100          0.001          32

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

explog-0.0.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

explog-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file explog-0.0.2.tar.gz.

File metadata

  • Download URL: explog-0.0.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for explog-0.0.2.tar.gz
Algorithm Hash digest
SHA256 659f13fc4e26b2163cf6a57ab47a0714970a13fbc0e0df8007361ab293e99f50
MD5 147e893af2454926d73e90d2d0be610f
BLAKE2b-256 683b06292f4c6964b67dff332b19703d13f093a8a8018eabe14229249249fc86

See more details on using hashes here.

File details

Details for the file explog-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: explog-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for explog-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dadf8f69d6eddda7b87c7afa9b76f9b1478dc2225bee94a6f309c8635af83c12
MD5 e0c64cd75f6d1605e933ccc0dd80d9fb
BLAKE2b-256 753ba8ae55f3a2709ec9af70400c4aed52d255a04ff5cc6188bef13490075606

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page