算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
track-ml-experiments【设计与创意】Set up MLflow tracking server for experiment management, configure autologging for popular ML frameworks, compare runs with metrics and visualizations, and manage artifacts in remote storage backends for reproducible machine learning workflows. Use when starting a new ML project that requires experiment tracking, migrating from manual logs to automat…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
見 Extended Examples 為全配檔與模
立 MLflow 追服、行全試追含度、參、物。
pip install mlflow)立 MLflow 追服含宜背。
# 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)
建配檔為隊享:
# 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)
得:MLflow UI 可訪於指 host:port、示空試列。服日確啟成無誤。
敗:察口可用以 netstat -tulpn | grep 5000、驗庫連串、確 S3 憑配(aws configure)、察防火牆規於遠訪。
啟框自記以自捕度、參、模。
# 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)
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)
得:行現於 MLflow UI 含諸超參、度(訓/驗失、準)、模物、入例自記。
敗:驗 MLflow 版於 ML 框合(mlflow.sklearn.autolog() 需 MLflow ≥1.20)、察自記支於模類否、閉自記用手記為退、用 mlflow.set_tracking_uri() 察日為連誤。
加自度、參、物、標為全試文。
# 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)
得:MLflow UI 示富試訊含逐步度、視物、模簽、入例、為濾搜之全標。
敗:察物存權(aws s3 ls s3://bucket/path)、驗 matplotlib 背為圖記(plt.switch_backend('Agg'))、確 JSON 可序資類為 log_dict、察碟空為本物存。
用 MLflow 比工析多試。
# 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)
命行比:
# 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
得:終出示序行含要度、HTML 報生含格比表、CSV 檔含諸行資為深析。
敗:以 mlflow experiments list 驗試在、察度名精配(敏)、確行成(察行態)、驗檔書權於出檔。
立 S3/Azure/GCS 背為可長物管。
# 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 為 MLflow 含 PostgreSQL 與 S3:
# docker-compose.yml
version: '3.8'
services:
postgres:
image: postgres:14
environment:
POSTGRES_DB: mlflow
# ... (see EXAMPLES.md for complete implementation)
得:物上載成於遠存、MLflow UI 示物鏈指 S3/Azure/GCS URI、由 UI 載物正行。
敗:以 aws s3 ls 或 az storage blob list 驗雲憑、察桶/容權(需書權)、確 MLflow 含雲附(pip install mlflow[extras])裝、測網於存端、察 CORS 為瀏訪。
立自清、藏、組策。
# 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)
得:舊試移至刪態、敗行自活列除、佳行標為易濾於 UI、存空復。
敗:察試權(必為主乃可刪)、驗行於 FAILED 態、確度於諸序行存、察庫連於批操、驗遠存物刪足權。
MLFLOW_TRACKING_URI 環變、察防火、確服行exclusive=True 或閉衝自記register-ml-model - 登追之模於 MLflow 模登version-ml-data - 用 DVC 為可重現試版資集setup-automl-pipeline - 整試追於自 ML 流deploy-ml-model-serving - 部最佳追之模於產orchestrate-ml-pipeline - 合試追與流協