Skip to main content

Yet Another Experiment Tracker - A lightweight experiment tracking harness

Project description

Yanex - Yet Another Experiment Tracker

PyPI version Python versions License

A lightweight, Git-aware experiment tracking system for Python that makes reproducible research effortless.

Yanex is inspired by the now-discontinued Guild AI (more info).

Why Yanex?

Stop losing track of your experiments. Yanex automatically tracks parameters, results, and code state so you can focus on what matters - your research.

import yanex

# read parameters from config file or CLI arguments
lr = yanex.get_param('lr', default=0.001)
epochs = yanex.get_param('epochs', default=10)

# your experiment code
# ...

# log results, artifacts and figures
yanex.log_metrics({"loss": loss, "accuracy": accuracy}, step=epoch)
yanex.copy_artifact(model_path, "model.pth")
yanex.save_artifact(fig, "loss_curve.png")

Run from the command line:

# Run with yanex CLI for automatic tracking
yanex run train.py --param lr=10e-3 --param epochs=10

That's it. Yanex creates a separate directory for each experiment, saves the logged results and files, stdout and stderr outptus, Python environment information, and even the Git state of your code repository. You can then compare results, search experiments, and reproduce them with ease.

Key Features

  • 🔒 Reproducible: Automatic Git state tracking ensures every experiment is reproducible
  • 📊 Interactive Comparison: Compare experiments side-by-side with an interactive table
  • ⚙️ Flexible Parameters: YAML configs with CLI overrides and syntax for parameter sweeps
  • Parallel Execution: Run multiple experiments simultaneously on multi-core systems
  • 📈 Rich Logging: Track metrics, artifacts, and figures
  • 🔍 Powerful Search: Find experiments by status, parameters, tags, or time ranges
  • 🤖 AI-Friendly: Machine-readable output formats, Claude Code skill, and yanex get for seamless AI assistant integration

Quick Start

Install

pip install yanex

1. Run Your First Experiment

# experiment.py
import yanex

params = yanex.get_params()
print(f"Learning rate: {params.get('learning_rate', 0.001)}")

# Simulate training
accuracy = 0.85 + (params.get('learning_rate', 0.001) * 10)

yanex.log_metrics({
    "accuracy": accuracy,
    "loss": 1 - accuracy
})
# Run with default parameters
yanex run experiment.py

# Override parameters
yanex run experiment.py --param learning_rate=0.01 --param epochs=50

# Add tags for organization
yanex run experiment.py --tag baseline --tag "quick-test"

2. Compare Results

# Interactive comparison table
yanex compare

# Compare specific experiments
yanex compare exp1 exp2 exp3

# Filter and compare
yanex compare -s completed -t baseline

3. Track Everything

List, search, and manage your experiments:

# List recent experiments
yanex list

# Find experiments by criteria
yanex list -s completed -t production
yanex list --started-after "1 week ago"

# Show detailed experiment info
yanex show exp_id

# Archive old experiments
yanex archive --started-before "1 month ago"

Programmatic Access

Yanex provides two APIs for working with experiments:

  • Run API: Create and execute experiments programmatically, ideal for k-fold cross-validation, ensemble training, and batch processing
  • Results API: Query, filter, and analyze completed experiments with pandas integration for advanced analysis

See the examples directory for practical demonstrations of both APIs.

Configuration Files

Create config.yaml for default parameters:

# config.yaml
model:
  learning_rate: 0.001
  batch_size: 32
  epochs: 100

data:
  dataset: "cifar10"
  augmentation: true

training:
  optimizer: "adam"
  scheduler: "cosine"

Parameter Sweeps & Parallel Execution

Run parameter sweeps with automatic parallelization:

# Run sweep in parallel with 4 workers
yanex run train.py --param "lr=range(0.01, 0.1, 0.01)" --parallel 4

# Auto-detect CPU count
yanex run train.py --param "lr=logspace(-4, -1, 10)" --parallel 0

Sweep Syntax:

# List of values
--param "batch_size=16, 32, 64, 128"

# Range: start, stop, step
--param "lr=range(0.01, 0.1, 0.01)"

# Linspace: start, stop, num_points
--param "lr=linspace(0.001, 0.1, 10)"

# Logspace: start_exp, stop_exp, num_points (uses powers of 10)
--param "lr=logspace(-4, -1, 10)"


# Multi-parameter sweep (cartesian product)
yanex run train.py \
  --param "lr=range(0.01, 0.1, 0.01)" \
  --param "batch_size=32, 64" \
  --parallel 4

See Configuration Guide for complete sweep syntax details.

Documentation

📚 Complete Documentation - Detailed guides and API reference

Quick Links:

Examples

  • CLI Examples - Main use case: Dual-mode scripts that work standalone or with yanex tracking
  • Run API Examples - Programmatic experiment creation for advanced patterns like k-fold cross-validation and batch processing
  • Results API Examples - Querying and analyzing completed experiments with pandas integration

AI & Automation

Yanex is designed for seamless integration with AI assistants and automation scripts.

Machine-readable output - Most commands support --format json, --format csv, and --format markdown:

yanex list -s completed -F json | jq '.[] | .id'
yanex compare -t sweep -F csv > results.csv

Quick field extraction - The yanex get command extracts individual values for scripting:

yanex get status abc12345           # → "completed"
yanex get params.lr abc12345        # → "0.001"
yanex get stdout abc12345 --tail 20 # Last 20 lines of output

→ Complete AI & Automation Guide

Claude Code Skill

Yanex includes a Claude Code skill for AI-assisted experiment management:

# Find your yanex installation
YANEX_PATH=$(python -c "import yanex; print(yanex.__path__[0])")

# Install globally or per-project
ln -s "$YANEX_PATH/claude-skill" ~/.claude/skills/tracking-yanex-experiments
# or: ln -s "$YANEX_PATH/claude-skill" .claude/skills/tracking-yanex-experiments

The skill enables Claude to run experiments, query results, monitor progress, and analyze data using yanex commands and APIs.

Contributing

Yanex is open source and welcomes contributions! See our contributing guidelines for details.

Built with assistance from Claude.

Contributors

The Yanex web UI (yanex ui) is being developed by Leon Lei (lytlei) as part of his Honours Thesis at the University of Sydney.

License

MIT License - see LICENSE for details.

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

yanex-0.6.0a2.tar.gz (613.0 kB view details)

Uploaded Source

Built Distribution

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

yanex-0.6.0a2-py3-none-any.whl (585.6 kB view details)

Uploaded Python 3

File details

Details for the file yanex-0.6.0a2.tar.gz.

File metadata

  • Download URL: yanex-0.6.0a2.tar.gz
  • Upload date:
  • Size: 613.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for yanex-0.6.0a2.tar.gz
Algorithm Hash digest
SHA256 4ccf58467e62b6bdf65ae48aa395739d5f7eeb76727effa80785db64ec410164
MD5 05bf2eddd0dc9194406ea2b2958d794d
BLAKE2b-256 5721e4b82ca9f746f4697aeaeae17fb013607d277b0771ef77e1b6ac4c6a9c44

See more details on using hashes here.

File details

Details for the file yanex-0.6.0a2-py3-none-any.whl.

File metadata

  • Download URL: yanex-0.6.0a2-py3-none-any.whl
  • Upload date:
  • Size: 585.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for yanex-0.6.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b2a7e4e39b37a6d62e88ee3a640a80f481d2c8df3d112420bade0c200fad03c1
MD5 3456058c0854324ba0f15eb4ed8fd560
BLAKE2b-256 384165e123c1b2dac4513227b951b44e3c81bec40f186ff43ef78708fc31a285

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