Store, manage, and compare machine learning experiments
Project description
MLT Experiments Library
A Python library for managing machine learning experiments. Store, retrieve, compare, and analyze your ML experiments effortlessly.
Features
✨ Easy Experiment Tracking
- Save experiment configurations, hyperparameters, models, and results
- Automatic timestamps and metadata management
📊 Experiment Comparison
- Compare multiple experiments side-by-side
- Find best experiments by metric
- Export to CSV for analysis
🏷️ Flexible Organization
- Tag experiments for easy filtering
- List experiments by tag
- Full experiment history
📁 Multiple Data Formats
- JSON export/import
- CSV export for spreadsheets
- Pandas DataFrame integration
🚀 11 Pre-defined ML Experiments (NEW in v0.2.0)
- View complete code for 11 different ML algorithms with just
mlt.exp(i) - Includes: Linear Regression, Logistic Regression, Decision Trees, Random Forest, SVM, K-Means, XGBoost, Neural Networks, Naive Bayes, PCA, Cross-Validation
- Perfect for learning and reference
Installation
From PyPI (once published)
pip install mlt-experiments
From source
git clone https://github.com/yourusername/mlt-experiments.git
cd mlt-experiments
pip install -e .
Quick Start
Viewing Experiment Code (NEW in v0.2.0)
import mlt_experiments as mlt
# Show Linear Regression code (Experiment 1)
mlt.exp(1)
# Show all available experiments
mlt.list_experiments()
# Get experiment code programmatically
code = mlt.get_experiment_code(5) # SVM
Tracking Your Experiments
from mlt_experiments import ExperimentTracker
# Initialize tracker
tracker = ExperimentTracker(data_dir="my_experiments")
# Save an experiment
tracker.save(
experiment_name="baseline_v1",
config={
"model": "RandomForest",
"learning_rate": 0.01,
"batch_size": 32,
"epochs": 100
},
results={
"accuracy": 0.92,
"loss": 0.23,
"precision": 0.89,
"recall": 0.91
},
tags=["baseline", "v1"]
)
# Load an experiment
exp = tracker.load("baseline_v1")
print(exp)
# List all experiments
experiments = tracker.list_all()
print(experiments)
# Compare experiments
comparison = tracker.compare(["baseline_v1", "baseline_v2"], metric="accuracy")
print(comparison)
# Get best experiment by metric
best = tracker.get_best(metric="accuracy", mode="max")
print(f"Best: {best['name']}")
# Export to CSV
tracker.export_to_csv("experiments_summary.csv")
API Reference
Experiment Library (NEW in v0.2.0)
exp(experiment_id: int)
Display the code for a specific ML experiment (1-11).
mlt.exp(1) # Show Linear Regression
mlt.exp(5) # Show SVM
mlt.exp(11) # Show Cross-Validation
list_experiments()
Display all 11 available experiments with names and descriptions.
mlt.list_experiments()
get_experiment_code(experiment_id: int) -> str
Get the code for an experiment as a string.
code = mlt.get_experiment_code(5)
with open("svm_experiment.py", "w") as f:
f.write(code)
get_experiment_info(experiment_id: int) -> dict
Get complete info (name, description, code) for an experiment.
info = mlt.get_experiment_info(7)
print(info['name']) # Gradient Boosting (XGBoost)
print(info['description']) # ...
print(info['code']) # Full code
ExperimentTracker
__init__(data_dir="experiments_data")
Initialize tracker with storage directory.
save(experiment_name, config, results, model_code="", tags=None)
Save experiment with metadata.
load(experiment_name)
Load specific experiment.
list_all()
Get list of all experiments.
list_by_tag(tag)
Get experiments with specific tag.
compare(experiment_names, metric=None)
Compare multiple experiments.
get_best(metric, mode="max")
Get best experiment by metric.
export_to_csv(output_file)
Export all experiments to CSV.
delete(experiment_name)
Delete an experiment.
Use Cases
- Research: Track different model architectures and hyperparameters
- Production: Compare model versions and performance
- Team Collaboration: Share experiments across team members
- Exam/Assignment: Store all lab work in organized, reproducible format
License
MIT License - see LICENSE file for details
Contributing
Contributions welcome! Please submit pull requests or issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlt_experiments_urk23cs5035-0.2.0.tar.gz.
File metadata
- Download URL: mlt_experiments_urk23cs5035-0.2.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
863a4e50869dd8c079279ae126abd09b143069700e19f1f528cb6491c527764f
|
|
| MD5 |
287662df8735606973b28dd2f7aead34
|
|
| BLAKE2b-256 |
3239feef143ce331c2a2f32ccffb2fd667db798d3ecb2ae0cc6735ebfba2ebbe
|
File details
Details for the file mlt_experiments_urk23cs5035-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mlt_experiments_urk23cs5035-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e71585a8f9a6b2d57de1469b1a3b1a9a622b17a3d0d68552c7acf2d43187059
|
|
| MD5 |
39005b6410b63190febc286f183400ef
|
|
| BLAKE2b-256 |
757f822c36dc378a79b7c8a91e38ffcc1c8c4865b7dd7208e5dc2698fe551d2b
|