Skip to main content

A minimal logging utility for machine learning experiments

Project description

MLog

A minimal logging utility for machine learning experiments.

Installation

> pip install pymlog

Logging

import mlog
import random

CONFIG = {'num_epochs': 100}

# Create a new run with an associated configuration
run = mlog.start(run='run_name', config=CONFIG, save='*.py')

# Log seamlessly
for epoch in range(CONFIG['num_epochs']):
    loss = random.random() * (1.05 ** (- epoch))
    run.log(epoch=epoch, loss=loss)
    metric = random.random()
    run.log(epoch=epoch, metric=metric)

Quick preview

> mlog plot epoch loss
> mlog plot epoch loss --aggregate median
> mlog plot epoch loss --aggregate median --intervals max
> mlog plot loss metric --scatter

Manage runs

> mlog list
        _name  num_epochs  learning_rate  batch_size
_run_id
1         run         100          0.001          32
2         run         100          0.001          32
3         run         100          0.001          32
4         run         100          0.001          32
5         run         100          0.001          32
6         run         100          0.001          32
7         run         100          0.001          32
8         run         100          0.001          32
9         run         100          0.001          32
10        run         100          0.001          32

This command starts an interactive interface where you can use commands like:

  • hjkl to navigate left, down, up and right,
  • gG to go up and down,
  • d to delete run,
  • space to preview plot,
  • q to exit.

Plotting

import mlog
import pandas as pd
import matplotlib.pyplot as plt

# Retrieve data
df = mlog.get('epoch', 'loss')
df = df.groupby('epoch').aggregate(['mean', 'min', 'max'])

# Plot data
fig, ax = plt.subplots()
ax.plot(df.index, df.loss['mean'])
ax.fill_between(df.index, df.loss['min'], df.loss['max'], alpha=0.4)
plt.show()

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

pymlog-0.0.25.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

pymlog-0.0.25-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pymlog-0.0.25.tar.gz.

File metadata

  • Download URL: pymlog-0.0.25.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pymlog-0.0.25.tar.gz
Algorithm Hash digest
SHA256 7791fce2def4fcc4a77e6f887b5d6757e313b92f92a526578c73ff7daad5e5d2
MD5 8d1fec7a6c7cecf9b50dffd9a8affa92
BLAKE2b-256 e302cb7689428845e8a6987ab8cb67658c2bee44131490542e1da029765cf872

See more details on using hashes here.

File details

Details for the file pymlog-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: pymlog-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pymlog-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 0686d0f4f6ba2bae0bcf8bf6b381198ffc286409f308c8efb8eea5369b60374c
MD5 4da6277e64bab3326d360790c3cc7ff8
BLAKE2b-256 a06d69c408c6f4aabfeee16c1d0d67cb49ae91f5bf8181fc4ceb3e5f072767c2

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