comet-ml
機械学習の実験記録、モデル管理、本番環境の監視を支援するComet MLの専門家として、実験の記録、モデル比較、再現可能なMLパイプライン構築を、コードやデータバージョン管理と共に行うSkill。
📜 元の英語説明(参考)
Expert guidance for Comet ML, the platform for tracking machine learning experiments, managing models, and monitoring production ML systems. Helps developers log experiments, compare model versions, and build reproducible ML pipelines with automatic code/data versioning.
🇯🇵 日本人クリエイター向け解説
機械学習の実験記録、モデル管理、本番環境の監視を支援するComet MLの専門家として、実験の記録、モデル比較、再現可能なMLパイプライン構築を、コードやデータバージョン管理と共に行うSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o comet-ml.zip https://jpskill.com/download/14770.zip && unzip -o comet-ml.zip && rm comet-ml.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14770.zip -OutFile "$d\comet-ml.zip"; Expand-Archive "$d\comet-ml.zip" -DestinationPath $d -Force; ri "$d\comet-ml.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
comet-ml.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
comet-mlフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Comet ML — ML実験の追跡とモデル管理
概要
Comet MLは、機械学習実験の追跡、モデルの管理、および本番MLシステムの監視のためのプラットフォームです。開発者が実験を記録し、モデルのバージョンを比較し、自動コード/データバージョン管理を使用して再現可能なMLパイプラインを構築するのに役立ちます。
手順
実験の追跡
# train.py — Comet MLでトレーニング実行を追跡する
import comet_ml
from comet_ml import Experiment
import torch
from torch import nn, optim
# 実験を初期化 — git情報、環境、および依存関係を自動的にログ記録します
experiment = Experiment(
api_key=os.environ["COMET_API_KEY"],
project_name="text-classifier",
workspace="my-team",
auto_metric_logging=True,
auto_param_logging=True,
auto_histogram_weight_logging=True,
log_code=True, # 完全なソースコードをログ記録します
)
# ハイパーパラメータをログ記録します
experiment.log_parameters({
"model": "distilbert-base-uncased",
"learning_rate": 2e-5,
"batch_size": 32,
"epochs": 5,
"optimizer": "AdamW",
"warmup_steps": 100,
"weight_decay": 0.01,
"max_seq_length": 256,
})
# データセット情報をログ記録します
experiment.log_dataset_hash(train_df) # 再現性のためのハッシュ
experiment.log_parameter("train_samples", len(train_df))
experiment.log_parameter("val_samples", len(val_df))
# メトリックのログ記録によるトレーニングループ
for epoch in range(5):
model.train()
running_loss = 0
for batch_idx, (inputs, labels) in enumerate(train_loader):
optimizer.zero_grad()
outputs = model(inputs)
loss = criterion(outputs, labels)
loss.backward()
optimizer.step()
running_loss += loss.item()
# バッチレベルのメトリックをログ記録します
experiment.log_metric("batch_loss", loss.item(),
step=epoch * len(train_loader) + batch_idx)
# エポックレベルのメトリックをログ記録します
avg_loss = running_loss / len(train_loader)
experiment.log_metric("train_loss", avg_loss, epoch=epoch)
# バリデーション
val_loss, val_acc, val_f1 = evaluate(model, val_loader)
experiment.log_metrics({
"val_loss": val_loss,
"val_accuracy": val_acc,
"val_f1": val_f1,
}, epoch=epoch)
print(f"Epoch {epoch}: loss={avg_loss:.4f} val_acc={val_acc:.4f}")
# モデルをログ記録します
experiment.log_model("text-classifier", "./model_weights.pt")
# 混同行列をログ記録します
experiment.log_confusion_matrix(
y_true=val_labels,
y_predicted=val_predictions,
labels=["negative", "neutral", "positive"],
)
# サンプルの予測をログ記録します
for i in range(10):
experiment.log_text(f"Input: {val_texts[i]}\nPredicted: {val_predictions[i]}\nActual: {val_labels[i]}")
# ダッシュボードでフィルタリングするためのタグを追加します
experiment.add_tags(["v2", "distilbert", "sentiment"])
experiment.end()
モデルレジストリ
# デプロイメントのためにモデルを登録およびバージョン管理します
from comet_ml import API
api = API(api_key=os.environ["COMET_API_KEY"])
# 実験からモデルを登録します
experiment = api.get_experiment("my-team", "text-classifier", "abc123")
# モデルレジストリに登録します
experiment.register_model(
model_name="text-classifier-prod",
version="1.2.0",
description="DistilBERT fine-tuned on customer reviews, F1=0.92",
tags=["production-ready"],
status="Production", # Staging | Production | Archived
)
# 登録されたモデルを取得します
model = api.get_model(workspace="my-team", model_name="text-classifier-prod")
latest = model.get_details("1.2.0")
print(f"Model: {latest['modelName']} v{latest['version']}")
print(f"Status: {latest['status']}")
# モデルアセットをダウンロードします
model.download("1.2.0", output_folder="./model_artifacts/")
# 2つのモデルバージョンを比較します
experiments = api.query("my-team", "text-classifier",
Expression("val_f1", ">", 0.85))
for exp in experiments:
print(f"{exp.id}: F1={exp.get_metric('val_f1')}")
LLMの追跡
# LLM/プロンプト実験を追跡します
from comet_ml import Experiment
from comet_ml.integration.openai import comet_openai_trace
# OpenAI API呼び出しを自動的にログ記録します
experiment = Experiment(project_name="llm-eval")
comet_openai_trace(experiment) # OpenAIクライアントをパッチします
# すべてのOpenAI呼び出しは、以下とともに自動的にログ記録されます。
# - プロンプトテキストとシステムメッセージ
# - 使用されたモデルとパラメータ
# - 応答テキスト
# - トークンの使用量とコスト
# - レイテンシ
response = openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Summarize this text..."}],
)
# ↑ Cometダッシュボードに自動的にログ記録されます
# 手動プロンプトのログ記録
experiment.log_text("prompt_template", "Summarize the following: {text}")
experiment.log_metric("prompt_tokens", response.usage.prompt_tokens)
experiment.log_metric("completion_tokens", response.usage.completion_tokens)
experiment.log_metric("total_cost", calculate_cost(response.usage))
実験の比較
# プログラムで実験をクエリおよび比較します
from comet_ml import API
api = API()
# プロジェクト内のすべての実験を取得します
experiments = api.get_experiments("my-team", "text-classifier")
# メトリックでフィルタリングします
best = sorted(experiments, key=lambda e: e.get_metric("val_f1") or 0, reverse=True)[:5]
for exp in best:
params = exp.get_parameters_summary()
metrics = exp.get_metrics_summary()
print(f"Experiment: {exp.name}")
print(f" Model: {params.get('model')}")
print(f" F1: {metrics.get('val_f1')}")
print(f" Accuracy: {metrics.get('val_accuracy')}")
インストール
pip install comet-ml
# フレームワーク統合の場合
pip install comet-ml[pytorch]
pip install comet-ml[tensorflow]
pip install comet-ml[sklearn]
例
例1: RAGアプリケーションの評価パイプラインのセットアップ
ユーザーリクエスト:
ドキュメントから質問に答えるRAGチャットボットがあります。 Comet Mlを設定して回答の品質を評価してください。
エージェントは、適切なメトリック(忠実性、関連性、回答の正確さ)を備えた評価スイートを作成します。
(原文はここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Comet ML — ML Experiment Tracking & Model Management
Overview
Comet ML, the platform for tracking machine learning experiments, managing models, and monitoring production ML systems. Helps developers log experiments, compare model versions, and build reproducible ML pipelines with automatic code/data versioning.
Instructions
Experiment Tracking
# train.py — Track a training run with Comet ML
import comet_ml
from comet_ml import Experiment
import torch
from torch import nn, optim
# Initialize experiment — auto-logs git info, environment, and dependencies
experiment = Experiment(
api_key=os.environ["COMET_API_KEY"],
project_name="text-classifier",
workspace="my-team",
auto_metric_logging=True,
auto_param_logging=True,
auto_histogram_weight_logging=True,
log_code=True, # Logs the full source code
)
# Log hyperparameters
experiment.log_parameters({
"model": "distilbert-base-uncased",
"learning_rate": 2e-5,
"batch_size": 32,
"epochs": 5,
"optimizer": "AdamW",
"warmup_steps": 100,
"weight_decay": 0.01,
"max_seq_length": 256,
})
# Log dataset information
experiment.log_dataset_hash(train_df) # Hash for reproducibility
experiment.log_parameter("train_samples", len(train_df))
experiment.log_parameter("val_samples", len(val_df))
# Training loop with metric logging
for epoch in range(5):
model.train()
running_loss = 0
for batch_idx, (inputs, labels) in enumerate(train_loader):
optimizer.zero_grad()
outputs = model(inputs)
loss = criterion(outputs, labels)
loss.backward()
optimizer.step()
running_loss += loss.item()
# Log batch-level metrics
experiment.log_metric("batch_loss", loss.item(),
step=epoch * len(train_loader) + batch_idx)
# Log epoch-level metrics
avg_loss = running_loss / len(train_loader)
experiment.log_metric("train_loss", avg_loss, epoch=epoch)
# Validation
val_loss, val_acc, val_f1 = evaluate(model, val_loader)
experiment.log_metrics({
"val_loss": val_loss,
"val_accuracy": val_acc,
"val_f1": val_f1,
}, epoch=epoch)
print(f"Epoch {epoch}: loss={avg_loss:.4f} val_acc={val_acc:.4f}")
# Log the model
experiment.log_model("text-classifier", "./model_weights.pt")
# Log confusion matrix
experiment.log_confusion_matrix(
y_true=val_labels,
y_predicted=val_predictions,
labels=["negative", "neutral", "positive"],
)
# Log sample predictions
for i in range(10):
experiment.log_text(f"Input: {val_texts[i]}\nPredicted: {val_predictions[i]}\nActual: {val_labels[i]}")
# Add tags for filtering in the dashboard
experiment.add_tags(["v2", "distilbert", "sentiment"])
experiment.end()
Model Registry
# Register and version models for deployment
from comet_ml import API
api = API(api_key=os.environ["COMET_API_KEY"])
# Register a model from an experiment
experiment = api.get_experiment("my-team", "text-classifier", "abc123")
# Register to model registry
experiment.register_model(
model_name="text-classifier-prod",
version="1.2.0",
description="DistilBERT fine-tuned on customer reviews, F1=0.92",
tags=["production-ready"],
status="Production", # Staging | Production | Archived
)
# Retrieve a registered model
model = api.get_model(workspace="my-team", model_name="text-classifier-prod")
latest = model.get_details("1.2.0")
print(f"Model: {latest['modelName']} v{latest['version']}")
print(f"Status: {latest['status']}")
# Download model assets
model.download("1.2.0", output_folder="./model_artifacts/")
# Compare two model versions
experiments = api.query("my-team", "text-classifier",
Expression("val_f1", ">", 0.85))
for exp in experiments:
print(f"{exp.id}: F1={exp.get_metric('val_f1')}")
LLM Tracking
# Track LLM/prompt experiments
from comet_ml import Experiment
from comet_ml.integration.openai import comet_openai_trace
# Auto-log OpenAI API calls
experiment = Experiment(project_name="llm-eval")
comet_openai_trace(experiment) # Patches OpenAI client
# All OpenAI calls are automatically logged with:
# - Prompt text and system message
# - Model used and parameters
# - Response text
# - Token usage and cost
# - Latency
response = openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Summarize this text..."}],
)
# ↑ Automatically logged to Comet dashboard
# Manual prompt logging
experiment.log_text("prompt_template", "Summarize the following: {text}")
experiment.log_metric("prompt_tokens", response.usage.prompt_tokens)
experiment.log_metric("completion_tokens", response.usage.completion_tokens)
experiment.log_metric("total_cost", calculate_cost(response.usage))
Comparing Experiments
# Query and compare experiments programmatically
from comet_ml import API
api = API()
# Get all experiments in a project
experiments = api.get_experiments("my-team", "text-classifier")
# Filter by metric
best = sorted(experiments, key=lambda e: e.get_metric("val_f1") or 0, reverse=True)[:5]
for exp in best:
params = exp.get_parameters_summary()
metrics = exp.get_metrics_summary()
print(f"Experiment: {exp.name}")
print(f" Model: {params.get('model')}")
print(f" F1: {metrics.get('val_f1')}")
print(f" Accuracy: {metrics.get('val_accuracy')}")
Installation
pip install comet-ml
# With framework integrations
pip install comet-ml[pytorch]
pip install comet-ml[tensorflow]
pip install comet-ml[sklearn]
Examples
Example 1: Setting up an evaluation pipeline for a RAG application
User request:
I have a RAG chatbot that answers questions from our docs. Set up Comet Ml to evaluate answer quality.
The agent creates an evaluation suite with appropriate metrics (faithfulness, relevance, answer correctness), configures test datasets from real user questions, runs baseline evaluations, and sets up CI integration so evaluations run on every prompt or retrieval change.
Example 2: Comparing model performance across prompts
User request:
We're testing GPT-4o vs Claude on our customer support prompts. Set up a comparison with Comet Ml.
The agent creates a structured experiment with the existing prompt set, configures both model providers, defines scoring criteria specific to customer support (accuracy, tone, completeness), runs the comparison, and generates a summary report with statistical significance indicators.
Guidelines
- Log everything from the start — It's cheaper to log and not need it than to re-run experiments because you forgot a metric
- Use auto-logging — Enable
auto_metric_loggingandauto_param_loggingto capture framework metrics automatically - Tag experiments — Use tags (
experiment.add_tags()) for filtering; tag by architecture, dataset version, or purpose - Model registry for deployment — Don't deploy from experiment artifacts; register models with versions and status tracking
- Log dataset hashes — Use
log_dataset_hash()for reproducibility; know exactly which data produced which results - Confusion matrices for classification — Always log confusion matrices; accuracy alone misses class imbalances
- Compare before deploying — Use Comet's comparison view to verify new models outperform current production across all metrics
- LLM cost tracking — Log token usage and calculated costs for every LLM call; costs add up fast in production