Skip to main content

MLTracker: Lightweight Machine Learning Experiment Tracker

MLTracker is a lightweight library for tracking machine learning experiments, models and metrics. It is a simple data model built on TinyDB. I create this for personal use but feel free to use it as you want.

📖 Full documentation: API Reference

Installation

pip install mltracker

Usage

Create an Experiment

from mltracker import getExperiment

experiment = getExperiment("my-experiment") # get or creates an experiment
print(experiment.id, experiment.name)

Add a model to track:

model = experiment.models.create(hash="123456", name="model1")
model.modules.add(name="conv_layer", attributes={"type": "conv", "layers": 3})
model.modules.add(name="actv_layer", attributes={"type": "relu"})
model.modules.add(name="linear_layer", attributes={"in_size": 256, "out_size": 10})

Track metrics:

model.metrics.add(name="accuracy", value=0.85, step=1, phase="train")
model.metrics.add(name="loss", value=0.25, step=1, phase="train") 
model.metrics.add(name="accuracy", value=0.87, step=1, phase="test")
model.metrics.add(name="loss", value=0.24, step=1, phase="test")
model.step += 1

model.metrics.add(name="accuracy", value=0.89, step=2, phase="train")
model.metrics.add(name="loss", value=0.29, step=2, phase="train")
model.metrics.add(name="accuracy", value=0.88, step=2, phase="test")
model.metrics.add(name="loss", value=0.26, step=2, phase="test")
model.step += 1

Track extra metadata:

iteration = model.iterations.create(step=2)
iteration.modules.add(name="SGD", attributes={"lr"=0.01})

Then just retrieve what you need.

model = experiment.models.read(hash="123456")
print(model.step)

for module in model.modules.list():
    print(module.name, module.attributes)

for metric in model.metrics.list(): 
    print(metric.name, metric.value)

This is MIT Licensed, feel free to use it as you please.

Release files for mltracker 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mltracker 0.4.0
File Size Uploaded
mltracker-0.4.0.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mltracker 0.4.0
File Interpreter ABI Platform
mltracker-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / mltracker-0.4.0.tar.gz

Download URL mltracker-0.4.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4fc20a908209fe92cc9ee1a088c846c66b1bdad45e74803518ad58f30491a6d9
BLAKE2b-256 checksum
How to use checksums
e9d02d8093d3f90c50955bd9c35d3e0d05c57f0ab7517106cb0312084a0f0c8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.1 Linux/6.11.0-1018-azure

Release files / mltracker-0.4.0-py3-none-any.whl

Download URL mltracker-0.4.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45b31ce9b79dea43659fb633934695224c1fa8f5999a61a4f89b8f5894036f1d
BLAKE2b-256 checksum
How to use checksums
e07c3d2813f68ecc088b09e768aa1fb2211b20fc3b69915301782bc62d3e0abc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.1 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page