Detects data drift in time series forecasting pipelines using RangeDriftDetector and PopulationDriftDetector. Covers range-based out-of-range detection and statistical distribution tests.
Ships in skforecast. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use drift detection to monitor whether new data falls outside the patterns seen during training. This helps decide when to retrain a model.
| Detector | Speed | Use Case |
|---|---|---|
RangeDriftDetector | Very fast | Real-time inference — checks if values are in training range |
PopulationDriftDetector | Moderate | Batch monitoring — statistical tests for distribution shifts |
forecasting-single-series / forecasting-multiple-series (the detector is fitted on the training data of an existing forecaster)prediction-intervals (intervals quantify uncertainty under the training distribution; drift detection flags when that distribution changes)Checks whether new observations fall within the ranges seen during training. Lightweight and suitable for real-time scoring.
fit()acceptsseriesandexogas a pandas Series, DataFrame, or dict (useful for multi-series pipelines withForecasterRecursiveMultiSeries).
from skforecast.drift_detection import RangeDriftDetector
from skforecast.recursive import ForecasterRecursive
# 1. Train the forecaster
forecaster = ForecasterRecursive(estimator=estimator, lags=24)
forecaster.fit(y=y_train, exog=exog_train)
# 2. Fit the drift detector on training data
detector = RangeDriftDetector()
detector.fit(series=y_train, exog=exog_train)
# 3. Check new data before making predictions
flag_drift, out_of_range_series, out_of_range_exog = detector.predict(
last_window=new_data,
exog=new_exog,
verbose=True, # Print drift details
suppress_warnings=False,
)
if flag_drift:
print("WARNING: New data contains values outside training range!")
print(f"Out-of-range series features: {out_of_range_series}")
print(f"Out-of-range exog features: {out_of_range_exog}")
Uses statistical tests to detect distribution shifts between reference (training) and new data.
fit(X)andpredict(X)expect a pandas DataFrame. For multi-series data, use a MultiIndex DataFrame with(series_id, date)index.
from skforecast.drift_detection import PopulationDriftDetector
# 1. Create detector
detector = PopulationDriftDetector(
chunk_size=100, # Split data into chunks of 100 obs
threshold=3, # Multiplier for std deviation
threshold_method='std', # 'std' or 'quantile'
max_out_of_range_proportion=0.1, # Max 10% out-of-range allowed
)
# 2. Fit on reference (training) data
detector.fit(X=X_train)
# 3. Detect drift in new data
results, summary = detector.predict(X=X_new)
# results: DataFrame with per-chunk drift statistics
# summary: DataFrame with per-feature drift summary
print(summary)
# Fixed number of observations per chunk
detector = PopulationDriftDetector(chunk_size=100)
# Time-based chunks
detector = PopulationDriftDetector(chunk_size='W') # Weekly
detector = PopulationDriftDetector(chunk_size='M') # Monthly
detector = PopulationDriftDetector(chunk_size='D') # Daily
# No chunking — compare entire datasets
detector = PopulationDriftDetector(chunk_size=None)
# Standard deviation method: flag if statistic > mean + threshold * std
detector = PopulationDriftDetector(
threshold=3,
threshold_method='std',
)
# Quantile method: flag if statistic > empirical quantile
detector = PopulationDriftDetector(
threshold=0.95, # 95th percentile
threshold_method='quantile',
)
from skforecast.recursive import ForecasterRecursive
from skforecast.drift_detection import RangeDriftDetector
# Train
forecaster = ForecasterRecursive(estimator=estimator, lags=24)
forecaster.fit(y=y_train, exog=exog_train)
# Set up monitoring
detector = RangeDriftDetector()
detector.fit(series=y_train, exog=exog_train)
# Production loop
def predict_with_monitoring(new_window, new_exog):
flag, _, _ = detector.predict(
last_window=new_window, exog=new_exog, verbose=False
)
if flag:
print("Drift detected — consider retraining the model")
return forecaster.predict(steps=10, exog=new_exog)
threshold=3 (3 sigma) and adjust based on false positive rate.What SKILL.md sets; muted values are Claude Code's defaults
/skforecast:drift-detectionfrom skforecast
npx claudepluginhub skforecast/skforecast --plugin skforecast17 skills in this plugin
/autocorrelation-and-lag-selectionAnalyzes time series dynamics with the fast skforecast.stats functions acf, pacf and calculate_lag_autocorrelation. Covers reading ACF/PACF patterns to identify AR/MA orders and seasonality, ranking lags by partial autocorrelation, and feeding the result to the lags argument of any skforecast forecaster. Use when the user wants to understand the dynamics of a series, choose a candidate set of lags before hyperparameter tuning, or replace a slow statsmodels acf/pacf call.
/backtesting-configurationConfigures TimeSeriesFold parameters for backtesting based on deployment scenarios. Maps business requirements (retraining frequency, forecast horizon, data budget) to cross-validation strategy parameters. Use when the user describes how they plan to deploy or evaluate a model.
/baseline-forecastingBuilds and evaluates simple baseline forecasts with ForecasterEquivalentDate (equivalent-date / seasonal-naive / moving-average) to benchmark machine learning models. Covers offset (int vs pandas DateOffset), n_offsets with agg_func, backtesting a baseline, comparing against ML with MASE, conformal intervals, and grid_search_equivalent_date. Use when the user wants a baseline, a naive or seasonal reference, or to check whether a model beats a simple rule. Not for choosing among ML forecasters (see choosing-a-forecaster) or tuning ML hyperparameters (see hyperparameter-optimization).
/choosing-a-forecasterGuides selection of the appropriate skforecast forecaster based on the user's data characteristics and requirements. Provides a decision matrix mapping use cases to forecaster classes. Use when the user is unsure which forecaster to use or asks for a recommendation.
/complete-api-referenceProvides complete constructor and method signatures for all skforecast forecasters, backtesting functions, search functions, cross-validation classes, preprocessing, feature selection, and drift detection. Use when the user needs exact parameter names, types, or defaults for any skforecast class or function.
/deep-learning-forecastingForecasts time series using recurrent neural networks (RNN, LSTM, GRU) with ForecasterRnn and the create_and_compile_model helper. Covers model architecture, training, and multi-series deep learning. Use when the user wants to use deep learning / neural networks for time series forecasting.
Other plugins' skills for the same job