본문으로 건너뛰기
cccskills
무료GitHub에 공개

monitor-model-drift

Implement comprehensive model drift monitoring using Evidently AI, statistical tests (PSI, KS), and custom metrics to detect data drift and concept drift in production ML systems. Set up automated alerting and reporting workflows to catch degradation before it impacts business metrics. Use when production models show unexplained performance degradation, when new data distributions differ from training data, when seasonal shifts affect input features, or when regulatory requirements mandate model monitoring.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Slack

실행 점수 미검증

설치 방법 보기

포함된 파일(2)

  • SKILL.md8.7 KB
  • references/EXAMPLES.md21.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Monitor Model Drift

See Extended Examples for complete configuration files and templates.

Detect and alert on data drift and concept drift in production ML models using statistical tests and automated monitoring.

When to Use

  • Production ML models experiencing unexplained performance degradation
  • New data distributions differ from training data
  • Seasonal or temporal shifts in input features
  • Need proactive alerts before business metrics are impacted
  • Regulatory requirements for model monitoring (e.g., SR 11-7, EU AI Act)
  • Multiple model versions deployed requiring drift comparison

Inputs

  • Required: Production model predictions and features (last 30-90 days)
  • Required: Reference dataset (training or validation data)
  • Required: Ground truth labels (may be delayed)
  • Optional: Feature importance scores or SHAP values
  • Optional: Business metric thresholds for alerting
  • Optional: Historical drift reports for trend analysis

Procedure

Step 1: Install and Configure Evidently AI

Set up the monitoring framework with appropriate dependencies.

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install Evidently and dependencies
pip install evidently pandas scikit-learn prometheus-client

# Create monitoring directory structure
mkdir -p monitoring/{reports,config,alerts}

Create configuration file:

# monitoring/config/drift_config.py
from evidently.metric_preset import DataDriftPreset, TargetDriftPreset
from evidently.metrics import (
    DatasetDriftMetric,
    DatasetMissingValuesMetric,
    ColumnDriftMetric,
)

# ... (see EXAMPLES.md for complete implementation)

Expected: Configuration file created with thresholds matching your model's tolerance.

On failure: Start with conservative thresholds (PSI > 0.2, KS p-value < 0.01) and tune based on false positive rate.

Step 2: Implement Data Drift Detection

Create drift detection pipeline with multiple statistical tests.

# monitoring/drift_detector.py
import pandas as pd
import numpy as np
from scipy.stats import ks_2samp, chi2_contingency
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset
from evidently.metrics import ColumnDriftMetric, DatasetDriftMetric
from datetime import datetime, timedelta
# ... (see EXAMPLES.md for complete implementation)

Expected: Drift detection runs successfully, produces JSON report with per-feature statistics, and identifies drifted features.

On failure: Check for missing values (impute or drop), ensure reference and current data have same columns, verify data types match between datasets.

Step 3: Generate Evidently Reports

Create visual HTML reports for human review and debugging.

# monitoring/generate_reports.py
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset, TargetDriftPreset
from evidently.metrics import (
    ColumnDriftMetric,
    DatasetDriftMetric,
    DatasetMissingValuesMetric,
)
# ... (see EXAMPLES.md for complete implementation)

Expected: HTML reports generated in monitoring/reports/, viewable in browser with interactive charts showing distribution comparisons.

On failure: Verify write permissions to output directory, check that Evidently version is >= 0.4.0, ensure data frames have sufficient rows (>100 recommended).

Step 4: Implement Concept Drift Detection

Monitor prediction performance to detect concept drift (relationship between features and target changes).

# monitoring/concept_drift.py
import pandas as pd
import numpy as np
from sklearn.metrics import roc_auc_score, mean_squared_error, accuracy_score
from typing import Dict, List
import json


# ... (see EXAMPLES.md for complete implementation)

Expected: Performance monitoring detects when model accuracy/AUC drops below threshold, signaling potential concept drift.

On failure: Ensure ground truth labels are available (may require delayed validation batch job), verify prediction scores are properly calibrated (0-1 range for classification), check for label leakage in features.

Step 5: Set Up Automated Alerting

Integrate drift detection with alerting systems (Slack, PagerDuty, email).

# monitoring/alerting.py
import requests
import json
from typing import Dict, List
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# ... (see EXAMPLES.md for complete implementation)

Expected: Alerts sent to Slack/PagerDuty when drift detected, with severity based on drift share and critical feature involvement.

On failure: Test webhook URLs with curl first, verify PagerDuty integration key has correct permissions, check firewall rules for outbound HTTPS, implement retry logic for transient network failures.

Step 6: Schedule Monitoring Jobs

Automate drift detection to run on schedule (daily or weekly).

# monitoring/scheduler.py
import schedule
import time
import logging
from datetime import datetime, timedelta
import pandas as pd

logging.basicConfig(
# ... (see EXAMPLES.md for complete implementation)

Alternatively, use cron:

# Add to crontab (crontab -e)
# Run daily at 2 AM
0 2 * * * cd /path/to/monitoring && /path/to/venv/bin/python scheduler.py >> logs/cron.log 2>&1

Or use Airflow DAG:

# airflow/dags/drift_monitoring_dag.py
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime, timedelta

default_args = {
    'owner': 'ml-team',
    'depends_on_past': False,
# ... (see EXAMPLES.md for complete implementation)

Expected: Monitoring runs automatically on schedule, generates reports, sends alerts only when drift exceeds thresholds, logs all activity.

On failure: Check scheduler process is running (ps aux | grep scheduler), verify cron service is active, ensure data sources are accessible, review logs for exceptions, set up dead man's switch alert if job doesn't run.

Validation

  • PSI and KS test calculations produce expected values for known drift scenarios
  • Evidently HTML reports render correctly and show distribution overlays
  • Critical feature drift triggers alerts immediately
  • Concept drift detector identifies performance degradation within 3 days
  • Alerts delivered to all configured channels (Slack, email, PagerDuty)
  • Scheduled job runs without manual intervention for 7+ days
  • False positive rate < 5% (tune thresholds if higher)
  • Drift detection completes in < 5 minutes for 1M rows

Common Pitfalls

  • Stale reference data: Update reference dataset quarterly or after model retraining to reflect natural data evolution
  • Sample size mismatch: Ensure current and reference datasets have similar sizes (>1000 rows each) for reliable statistics
  • Missing ground truth: Concept drift requires labels; implement delayed labeling pipeline if real-time labels unavailable
  • Seasonality confusion: Weekly/monthly patterns may trigger false positives; use time-aligned reference windows or deseasonalize features
  • Alert fatigue: Start with high thresholds and gradually lower based on actual model retraining cadence
  • Ignoring data quality drift: Monitor missing values, outliers, and encoding errors separately from distribution drift
  • Over-reliance on aggregate metrics: Per-feature analysis crucial; aggregate drift may mask critical individual feature shifts
  • Neglecting prediction distribution: Even without ground truth, sudden prediction distribution shifts signal issues

Related Skills

  • detect-anomalies-aiops - Time series anomaly detection for operational metrics
  • deploy-ml-model-serving - Model deployment patterns and versioning
  • setup-prometheus-monitoring - Infrastructure metrics collection
  • review-data-analysis - Statistical analysis validation and peer review

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Execute structural metamorphosis using strangler fig migration, chrysalis phases, and interface preservation. Covers transformation planning, parallel running, progressive cutover, rollback design, and post-metamorphosis stabilization for system architecture evolution. Use when assess-form has classified the system as READY for transformation, when migrating from monolith to microservices, when replacing a core subsystem while dependents continue operating, or when any architectural change must be gradual rather than big-bang.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

pjt222/agent-almanac422026년 10월 23일 업데이트

adaptic

무료

Master skill composing the 5-step synoptic cycle for panoramic synthesis across multiple domains. Orchestrates meditate, expand-awareness, observe, awareness, integrate-gestalt, and express-insight into a coherent process that produces unified understanding rather than sequential compromise. Use when a problem genuinely spans 3+ domains and the interactions between domains matter more than depth in any one, when sequential analysis feels like compromise rather than integration, or before major architectural decisions affecting multiple stakeholders.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

pjt222/agent-almanac422026년 10월 23일 업데이트

Scaffold a new puzzle type across all 10+ pipeline integration points in jigsawR. Creates the core puzzle module, wires it into the unified pipeline (generation, positioning, rendering, adjacency), adds ggpuzzle geom/stat layers, updates DESCRIPTION and config.yml, extends the Shiny app, and creates a comprehensive test suite. Use when adding a completely new puzzle type to the package or following the 10-point integration checklist to ensure nothing is missed end-to-end.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

pjt222/agent-almanac422026년 10월 23일 업데이트

Add Rcpp or RcppArmadillo integration to an R package for high-performance C++ code. Covers setup, writing C++ functions, RcppExports generation, testing compiled code, and debugging. Use when an R function is too slow and profiling confirms a bottleneck, when you need to interface with existing C/C++ libraries, or when implementing algorithms (loops, recursion, linear algebra) that benefit from compiled code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

pjt222/agent-almanac422026년 10월 23일 업데이트

aikido

무료

Practice aikido as a defensive martial art emphasizing harmony, redirection, and controlled resolution. Covers centering and grounding, ukemi (safe falling and rolling), core techniques (irimi-nage, shiho-nage, kote-gaeshi, ikkyo), blending and tai sabaki (body movement), randori (multiple attacker practice), weapons awareness, and applying principles off the mat. Use when learning a defensive martial art that prioritizes de-escalation, developing the ability to redirect aggression without causing unnecessary harm, building safe falling skills, or cultivating calm centeredness under physical pressure.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

pjt222/agent-almanac422026년 10월 23일 업데이트

Analyze an arbitrary codebase to identify functions, APIs, and data sources suitable for exposure as MCP tools, producing a tool specification document. Use when planning an MCP server for an existing project, auditing a codebase before wrapping it as an AI-accessible tool surface, comparing what a codebase can do versus what is already exposed via MCP, or generating a tool spec to hand off to scaffold-mcp-server.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

pjt222/agent-almanac422026년 10월 23일 업데이트

pjt222의 스킬 모두 보기

이 스킬의 문제 신고