mlops-workflows
БесплатноБез исполняемых скриптовНе проверенComprehensive MLOps workflows for the complete ML lifecycle - experiment tracking, model registry, deployment patterns, monitoring, A/B testing, and…
Об этом скилле
MLOps Workflows with MLflow
A comprehensive guide to production-grade MLOps workflows covering the complete machine learning lifecycle from experimentation to production deployment and monitoring.
Table of Contents
- MLflow Components Overview
- Experiment Tracking
- Model Registry
- Deployment Patterns
- Monitoring and Observability
- A/B Testing
- Feature Stores
- CI/CD for ML
- Model Versioning
- Production Best Practices
MLflow Components Overview
MLflow consists of four primary components for managing the ML lifecycle:
1. MLflow Tracking
Track experiments, parameters, metrics, and artifacts during model development.
import mlflow
# Set tracking URI
mlflow.set_tracking_uri("http://localhost:5000")
# Create or set experiment
mlflow.set_experiment("production-models")
# Start a run
with mlflow.start_run(run_name="baseline-model"):
# Log parameters
mlflow.log_param("learning_rate", 0.01)
mlflow.log_param("batch_size", 32)
# Log metrics
mlflow.log_metric("accuracy", 0.95)
mlflow.log_metric("loss", 0.05)
# Log artifacts
mlflow.log_artifact("model_plot.png")
2. MLflow Projects
Package ML code in a reusable, reproducible format.
# MLproject file
name: my-ml-project
conda_env: conda.yaml
entry_points:
main:
parameters:
learning_rate: {type: float, default: 0.01}
epochs: {type: int, default: 100}
command: "python train.py --lr {learning_rate} --epochs {epochs}"
evaluate:
parameters:
model_uri: {type: string}
command: "python evaluate.py --model-uri {model_uri}"
3. MLflow Models
Package models in a standard format for deployment across platforms.
import mlflow.sklearn
from sklearn.ensemble import RandomForestClassifier
# Train model
model = RandomForestClassifier()
model.fit(X_train, y_train)
# Log model with signature
from mlflow.models import infer_signature
signature = infer_signature(X_train, model.predict(X_train))
mlflow.sklearn.log_model(
sk_model=model,
name="random-forest-model",
signature=signature,
input_example=X_train[:5],
registered_model_name="ProductionClassifier"
)
4. MLflow Registry
Centralized model store for managing model lifecycle and versioning.
from mlflow import MlflowClient
client = MlflowClient()
# Register model
model_uri = f"runs:/{run_id}/model"
registered_model = mlflow.register_model(
model_uri=model_uri,
name="CustomerChurnModel"
)
# Set model alias for deployment
client.set_registered_model_alias(
name="CustomerChurnModel",
alias="production",
version=registered_model.version
)
Experiment Tracking
Basic Experiment Tracking
import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.model_selection import train_test_split
# Configure MLflow
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("house-price-prediction")
# Load and prepare data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Training with MLflow tracking
with mlflow.start_run(run_name="rf-baseline"):
# Define parameters
params = {
"n_estimators": 100,
"max_depth": 10,
"min_samples_split": 5,
"random_state": 42
}
# Train model
model = RandomForestRegressor(**params)
model.fit(X_train, y_train)
# Evaluate
predictions = model.predict(X_test)
mse = mean_squared_error(y_test, predictions)
r2 = r2_score(y_test, predictions)
# Log everything
mlflow.log_params(params)
mlflow.log_metrics({
"mse": mse,
"r2": r2,
"rmse": mse ** 0.5
})
# Log model
mlflow.sklearn.log_model(
sk_model=model,
name="model",
registered_model_name="HousePricePredictor"
)
Autologging
MLflow provides automatic logging for popular frameworks:
import mlflow
from sklearn.ensemble import RandomForestClassifier
# Enable autologging for scikit-learn
mlflow.sklearn.autolog()
# Your training code - everything is logged automatically
with mlflow.start_run():
model = RandomForestClassifier(n_estimators=100, max_depth=5)
model.fit(X_train, y_train)
predictions = model.predict(X_test)
Nested Runs for Hyperparameter Tuning
import mlflow
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import GradientBoostingClassifier
mlflow.set_experiment("hyperparameter-tuning")
# Parent run for the entire tuning process
with mlflow.start_run(run_name="grid-search-parent"):
param_grid = {
'learning_rate': [0.01, 0.1, 0.3],
Установить mlops-workflows в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл mlops-workflows?
Comprehensive MLOps workflows for the complete ML lifecycle - experiment tracking, model registry, deployment patterns, monitoring, A/B testing, and production best practices with MLflow
Как установить скилл mlops-workflows?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mlops-workflows запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic