Skip to main content

Track machine learning experiments.

Project description

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, epoch=1, phase="train")
model.metrics.add(name="loss", value=0.25, epoch=1, phase="train") 
model.metrics.add(name="accuracy", value=0.87, epoch=1, phase="test")
model.metrics.add(name="loss", value=0.24, epoch=1, phase="test")
model.epoch += 1

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

Track extra metadata:

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

Then just retrieve what you need.

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

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.

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

mltracker-0.3.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

mltracker-0.3.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file mltracker-0.3.1.tar.gz.

File metadata

  • Download URL: mltracker-0.3.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for mltracker-0.3.1.tar.gz
Algorithm Hash digest
SHA256 25073c7eaaec084d00467f123a1ff8900f0d2b5ef5dc197d9dde9157ef2ac4f5
MD5 089ad18d23c727c3fff6dd854fe8903a
BLAKE2b-256 aafac89ca75bc59a257e2529e5f0f348616cfff2ed4ae8152d9464c7691a2f79

See more details on using hashes here.

File details

Details for the file mltracker-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: mltracker-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for mltracker-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9adfd66f9276a4a8c4cb5cf7df96b2f0bf0bab57ff1ee298421c9a0fb83d2d9
MD5 ce08424414dcce30e85256e9fd34aab6
BLAKE2b-256 7ae4aa75444da79fb1d73c8e1e5ed3113c4e6f1e39cc0b8241a432be9460c196

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