track-ml-experiments
Acerca de
Esta habilidad configura MLflow para el seguimiento de experimentos de aprendizaje automático con autologging, comparación de métricas y gestión de artefactos. Es ideal para iniciar nuevos proyectos de ML, migrar desde registros manuales o construir flujos de trabajo reproducibles. Los desarrolladores pueden usarla para comparar sistemáticamente ejecuciones de entrenamiento y mantener un linaje completo de experimentos.
Instalación rápida
Claude Code
Recomendadonpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/track-ml-experimentsCopia y pega este comando en Claude Code para instalar esta habilidad
Documentación
Track ML Experiments
See Extended Examples for complete configuration files and templates.
Set up MLflow tracking server. Implement comprehensive experiment tracking with metrics, parameters, artifacts.
When Use
- Starting new machine learning project needing experiment tracking
- Migrating from manual experiment logs to automated tracking
- Comparing multiple model training runs systematic
- Sharing experiment results with team members
- Building reproducible ML workflows with full lineage tracking
- Integrating experiment tracking into CI/CD pipelines
Inputs
- Required: Python environment with ML framework (sklearn, pytorch, tensorflow, xgboost)
- Required: MLflow installation (
pip install mlflow) - Optional: Remote storage backend (S3, Azure Blob, GCS) for artifacts
- Optional: Database backend (PostgreSQL, MySQL) for metadata storage
- Optional: Authentication credentials for remote backends
Steps
Step 1: Initialize MLflow Tracking Server
Set up MLflow tracking server with appropriate backend stores.
# Option 1: Local file-based tracking (development)
mkdir -p mlruns
export MLFLOW_TRACKING_URI="file:./mlruns"
# Option 2: SQLite backend with local artifacts
mlflow server \
--backend-store-uri sqlite:///mlflow.db \
--default-artifact-root ./mlartifacts \
# ... (see EXAMPLES.md for complete implementation)
Create a configuration file for team sharing:
# mlflow_config.py
import os
MLFLOW_TRACKING_URI = os.getenv(
"MLFLOW_TRACKING_URI",
"http://mlflow-server.company.com:5000"
)
# ... (see EXAMPLES.md for complete implementation)
Got: MLflow UI accessible at specified host:port, showing empty experiments list. Server logs confirm successful startup without errors.
If fail: Check port availability with netstat -tulpn | grep 5000, verify database connection strings, ensure S3 credentials configured (aws configure), check firewall rules for remote access.
Step 2: Configure Autologging for ML Frameworks
Enable framework-specific autologging to capture metrics, parameters, models automatic.
# training_script.py
import mlflow
from mlflow_config import MLFLOW_TRACKING_URI, MLFLOW_EXPERIMENT_NAME
# Set tracking URI
mlflow.set_tracking_uri(MLFLOW_TRACKING_URI)
mlflow.set_experiment(MLFLOW_EXPERIMENT_NAME)
# ... (see EXAMPLES.md for complete implementation)
For PyTorch:
import mlflow.pytorch
mlflow.pytorch.autolog(
log_every_n_epoch=1,
log_every_n_step=None,
log_models=True,
disable=False,
exclusive=False,
# ... (see EXAMPLES.md for complete implementation)
Got: Run appears in MLflow UI with all hyperparameters, metrics (training/validation loss, accuracy), model artifacts, input examples automatic logged.
If fail: Verify MLflow version compatibility with ML framework (mlflow.sklearn.autolog() needs MLflow ≥1.20), check if autologging supported for your model type, disable autologging and use manual logging as fallback, inspect logs with mlflow.set_tracking_uri() for connection errors.
Step 3: Implement Comprehensive Manual Logging
Add custom metrics, parameters, artifacts, tags for complete experiment documentation.
# comprehensive_tracking.py
import mlflow
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
def train_and_log_model(params, X_train, y_train, X_test, y_test):
"""
# ... (see EXAMPLES.md for complete implementation)
Got: MLflow UI displays rich experiment information including step-by-step metrics, visualization artifacts, model signature, input examples, comprehensive tags for filtering and searching.
If fail: Check artifact storage permissions (aws s3 ls s3://bucket/path), verify matplotlib backend for figure logging (plt.switch_backend('Agg')), ensure JSON-serializable data types for log_dict, check disk space for local artifact storage.
Step 4: Compare Runs and Generate Reports
Use MLflow's comparison tools to analyze multiple experiments.
# compare_runs.py
import mlflow
from mlflow.tracking import MlflowClient
client = MlflowClient()
def compare_experiments(experiment_name, metric_name="test_accuracy", top_n=5):
"""
# ... (see EXAMPLES.md for complete implementation)
Command-line comparison:
# Compare runs using MLflow CLI
mlflow runs compare --experiment-name customer-churn \
--order-by "metrics.test_accuracy DESC" \
--max-results 10
# Export run data to CSV
mlflow experiments csv --experiment-name customer-churn \
--output experiments.csv
Got: Console output shows sorted runs with key metrics, HTML report generated with formatted comparison table, CSV file contains all run data for further analysis.
If fail: Verify experiment exists with mlflow experiments list, check metric names match exact (case-sensitive), ensure runs completed success (check run status), verify file write permissions for output files.
Step 5: Configure Remote Artifact Storage
Set up S3/Azure/GCS backends for scalable artifact management.
# artifact_storage_config.py
import mlflow
import os
def configure_s3_backend():
"""
Configure S3 for artifact storage.
"""
# ... (see EXAMPLES.md for complete implementation)
Docker Compose for MLflow with PostgreSQL and S3:
# docker-compose.yml
version: '3.8'
services:
postgres:
image: postgres:14
environment:
POSTGRES_DB: mlflow
# ... (see EXAMPLES.md for complete implementation)
Got: Artifacts upload success to remote storage, MLflow UI shows artifact links pointing to S3/Azure/GCS URIs, downloading artifacts from UI works correct.
If fail: Verify cloud credentials with aws s3 ls or az storage blob list, check bucket/container permissions (need write access), ensure MLflow installed with cloud extras (pip install mlflow[extras]), test network connectivity to storage endpoints, check CORS settings for browser access.
Step 6: Implement Experiment Lifecycle Management
Set up automated cleanup, archival, organization policies.
# lifecycle_management.py
import mlflow
from mlflow.tracking import MlflowClient
from datetime import datetime, timedelta
client = MlflowClient()
def archive_old_experiments(days_old=90):
# ... (see EXAMPLES.md for complete implementation)
Got: Old experiments moved to deleted state, failed runs removed from active list, best runs tagged for easy filtering in UI, storage space reclaimed.
If fail: Check experiment permissions (must be owner to delete), verify runs actually in FAILED status, ensure metric exists for all runs being ranked, check database connectivity for bulk operations, verify sufficient permissions for artifact deletion in remote storage.
Checks
- MLflow tracking server accessible via web UI
- Experiments created and runs logged success
- Autologging captures framework-specific metrics automatic
- Custom metrics, parameters, artifacts logged correct
- Comparison queries return expected top runs
- Remote artifact storage configured and functional
- Artifacts downloadable from UI and programmatic
- Run filtering and searching works with tags
- HTML comparison reports generated without errors
- Lifecycle management scripts execute success
Pitfalls
- Connection timeouts: MLflow server not accessible from training scripts - verify
MLFLOW_TRACKING_URIenvironment variable, check firewall rules, ensure server running - Artifact upload failures: S3/Azure credentials not configured or bucket doesn't exist - test cloud CLI access first, verify bucket permissions
- Missing metrics: Autologging disabled or unsupported framework version - check MLflow version compatibility, fall back to manual logging
- Run clutter: Too many experimental runs polluting UI - implement tagging strategy early, use lifecycle management scripts regular
- Large artifacts: Logging entire datasets causes storage bloat - log only samples or references, use external data versioning (DVC)
- Inconsistent naming: Parameters logged with different names across runs - standardize naming conventions in config file
- Database locks: SQLite doesn't support concurrent writes - use PostgreSQL/MySQL for multi-user environments
- Autolog conflicts: Multiple autolog configurations interfere - use
exclusive=Trueor disable conflicting autologs
See Also
register-ml-model- Register tracked models in MLflow Model Registryversion-ml-data- Version datasets using DVC for reproducible experimentssetup-automl-pipeline- Integrate experiment tracking into automated ML pipelinesdeploy-ml-model-serving- Deploy best-performing tracked models to productionorchestrate-ml-pipeline- Combine experiment tracking with workflow orchestration
Repositorio GitHub
Habilidades relacionadas
content-collections
MetaEsta habilidad proporciona una configuración probada en producción para Content Collections, una herramienta centrada en TypeScript que transforma archivos Markdown/MDX en colecciones de datos con tipado seguro mediante validación Zod. Úsala al construir blogs, sitios de documentación o aplicaciones Vite + React con mucho contenido para garantizar seguridad de tipos y validación automática de contenido. Abarca todo, desde la configuración del plugin de Vite y compilación MDX hasta la optimización de despliegue y validación de esquemas.
polymarket
MetaEsta habilidad permite a los desarrolladores crear aplicaciones con la plataforma de mercados de predicción Polymarket, incluyendo la integración de API para operaciones y datos de mercado. También proporciona transmisión de datos en tiempo real a través de WebSocket para monitorear operaciones en vivo y actividad del mercado. Úsela para implementar estrategias de trading o crear herramientas que procesen actualizaciones de mercado en tiempo real.
creating-opencode-plugins
MetaEsta habilidad ayuda a los desarrolladores a crear complementos de OpenCode que se conectan a más de 25 tipos de eventos, como comandos, archivos y operaciones LSP. Proporciona la estructura del complemento, las especificaciones de la API de eventos y los patrones de implementación para módulos en JavaScript/TypeScript. Úsala cuando necesites interceptar, monitorear o extender el ciclo de vida del asistente de IA de OpenCode con lógica personalizada basada en eventos.
sglang
MetaSGLang es un framework de alto rendimiento para el servicio de LLM que se especializa en generación rápida y estructurada para JSON, expresiones regulares y flujos de trabajo de agentes utilizando su caché de prefijos RadixAttention. Ofrece una inferencia significativamente más rápida, especialmente para tareas con prefijos repetidos, lo que lo hace ideal para salidas complejas y estructuradas, y conversaciones multiturno. Elige SGLang sobre alternativas como vLLM cuando necesites decodificación restringida o estés construyendo aplicaciones con uso extensivo de prefijos compartidos.
