Diagnoses and fixes common skforecast errors including deprecated imports, wrong function names, missing parameters, and data format issues. Use when generated skforecast code produces errors or unexpected results.
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 this skill when generated skforecast code raises an error, produces unexpected
results, or uses an import path, class name or function that no longer exists. It is
the full pitfall catalog; the highest-risk skills also carry a focused
## Stop Conditions table that points back here.
## Stop Conditions tables point back tocomplete-api-reference (confirm the exact signature before assuming a bug)choosing-a-forecaster (many errors come from using the wrong forecaster for the data shape)The most frequent LLM error. Old import paths no longer exist.
| Wrong (Deprecated) | Correct (v0.14.0+) |
|---|---|
from skforecast.ForecasterAutoreg import ForecasterAutoreg | from skforecast.recursive import ForecasterRecursive |
from skforecast.ForecasterAutoregMultiSeries import ForecasterAutoregMultiSeries | from skforecast.recursive import ForecasterRecursiveMultiSeries |
from skforecast.ForecasterAutoregDirect import ForecasterAutoregDirect | from skforecast.direct import ForecasterDirect |
from skforecast.ForecasterAutoregMultiVariate import ForecasterAutoregMultiVariate | from skforecast.direct import ForecasterDirectMultiVariate |
from skforecast.model_selection_multiseries import backtesting_forecaster_multiseries | from skforecast.model_selection import backtesting_forecaster_multiseries |
| Wrong | Correct |
|---|---|
ForecasterAutoreg | ForecasterRecursive |
ForecasterAutoregMultiSeries | ForecasterRecursiveMultiSeries |
ForecasterAutoregDirect | ForecasterDirect |
ForecasterAutoregMultiVariate | ForecasterDirectMultiVariate |
ForecasterSarimax | ForecasterStats(estimator=Sarimax(...)) |
| Removed (v0.22.0+) | Replacement |
|---|---|
regressor=... | estimator=... (in all Forecasters) |
# ❌ WRONG: setting categorical features directly on the estimator
forecaster = ForecasterRecursive(
estimator=LGBMRegressor(categorical_feature=[0, 1]),
lags=24,
)
# ✅ CORRECT: use categorical_features parameter on the forecaster
forecaster = ForecasterRecursive(
estimator=LGBMRegressor(),
lags=24,
categorical_features='auto', # or ['col_name_1', 'col_name_2']
)
# Fix: set the frequency
data = data.asfreq('h') # Hourly
data = data.asfreq('D') # Daily
data = data.asfreq('MS') # Monthly start
data = data.asfreq('QS') # Quarterly start
# Fix 1 (recommended for NaN-tolerant estimators): keep NaN rows
forecaster = ForecasterRecursive(
estimator=LGBMRegressor(verbose=-1), # LightGBM handles NaN natively
lags=14,
dropna_from_series=False, # Default — NaN rows kept in training matrices
)
forecaster.fit(y=data['target'], suppress_warnings=True)
# Fix 2: drop rows with NaN from training matrices
forecaster = ForecasterRecursive(
estimator=RandomForestRegressor(),
lags=14,
dropna_from_series=True, # Drop NaN rows before fitting
)
# Fix 3: impute missing values before fitting
data = data.ffill() # Forward fill
data = data.interpolate(method='linear') # Linear interpolation
A predictor has a missing value when predicting and the estimator does not
accept them. Usually a gap in exog in the forecast horizon, or in the last
window.
LinearRegression, Ridge, Lasso...):
Input X contains NaN in the predictors ['x'] ... at step 6 (2020-04-05),
with the predictor, the step, the date and, in
ForecasterRecursiveMultiSeries, the series.Input X contains NaN., without those details.If the predictor is _level_skforecast, the NaN is not in the data: a series
not seen during training gets NaN with an ordinal encoding. Predict it with
encoding='onehot' or encoding=None, or with an estimator that accepts NaN.
# Fix 1: fill the gaps of exog before predicting or backtesting
exog = exog.interpolate(method='linear')
# Fix 2: use an estimator that accepts missing values
forecaster = ForecasterRecursive(
estimator=HistGradientBoostingRegressor(), # or LGBMRegressor(verbose=-1)
lags=14,
)
With differentiation, any estimator (also HistGradientBoostingRegressor)
raises The series (or last_window) has missing values (NaN) at [...] when
one of the last differentiation values of the series or of last_window is
missing: the predictions are reverted to the original scale from them, so all
of them would be NaN. Fill that value (an estimator that accepts NaN does not
help).
Backtesting does not raise these errors: the dates that cannot be predicted
get NaN predictions, so a missing value that only affects the discarded steps
of the gap does not matter. If NaN predictions reach the scored dates:
backtesting_forecaster (one series) raises
N backtesting predictions are NaN at dates with observed values ...,
with the first date, the likely causes and the remedy (same fixes as above).backtesting_forecaster_multiseries leaves them out of the metrics with a
MissingValuesWarning that gives their number per series. Read it: the
metrics use fewer values than predicted.# Fix: exog for prediction must cover ALL future steps
# If predicting 10 steps ahead, exog_test must have at least 10 rows
# with dates matching the expected forecast dates
exog_test = exog.loc[forecast_start:forecast_end]
predictions = forecaster.predict(steps=10, exog=exog_test)
# ❌ WRONG: using backtesting_forecaster with ForecasterStats
from skforecast.model_selection import backtesting_forecaster
backtesting_forecaster(forecaster=forecaster_stats, y=y, cv=cv, metric=metric) # Error!
# ✅ CORRECT: use backtesting_stats for statistical models
from skforecast.model_selection import backtesting_stats
backtesting_stats(forecaster=forecaster_stats, y=y, cv=cv, metric=metric)
# ❌ WRONG: using backtesting_forecaster with ForecasterRecursiveMultiSeries
backtesting_forecaster(forecaster=forecaster_multi, y=y, cv=cv, metric=metric) # Error!
# ✅ CORRECT: use backtesting_forecaster_multiseries
from skforecast.model_selection import backtesting_forecaster_multiseries
backtesting_forecaster_multiseries(
forecaster=forecaster_multi, series=series, cv=cv, metric=metric
)
# ❌ WRONG: grid_search_forecaster with ForecasterStats
grid_search_forecaster(forecaster=forecaster_stats, y=y, cv=cv, param_grid=param_grid)
# ✅ CORRECT: grid_search_stats for statistical models
from skforecast.model_selection import grid_search_stats
grid_search_stats(forecaster=forecaster_stats, y=y, cv=cv, param_grid=param_grid)
# ❌ WRONG: grid_search_forecaster with ForecasterEquivalentDate
grid_search_forecaster(forecaster=forecaster_baseline, y=y, cv=cv, param_grid=param_grid)
# ✅ CORRECT: grid_search_equivalent_date for baselines (offset/n_offsets are coupled;
# agg_func is also searchable; pass a list of dicts to test explicit
# configs, optional 'alias' label)
from skforecast.model_selection import grid_search_equivalent_date
grid_search_equivalent_date(
forecaster=forecaster_baseline, y=y, cv=cv,
param_grid=[{'offset': 1, 'n_offsets': 7}, {'offset': 7, 'n_offsets': 2}],
metric='mean_absolute_error',
)
# ❌ WRONG: grid_search_forecaster with ForecasterRecursiveMultiSeries
grid_search_forecaster(forecaster=forecaster_multi, y=y, cv=cv, param_grid=param_grid)
# ✅ CORRECT: grid_search_forecaster_multiseries
from skforecast.model_selection import grid_search_forecaster_multiseries
grid_search_forecaster_multiseries(
forecaster=forecaster_multi, series=series, cv=cv, param_grid=param_grid
)
# ❌ WRONG: bayesian_search_forecaster with ForecasterFoundation
bayesian_search_forecaster(forecaster=forecaster_foundation, y=y, cv=cv, search_space=search_space)
# ✅ CORRECT: bayesian_search_foundation (TimeSeriesFold only, no 'lags' in search_space)
from skforecast.model_selection import bayesian_search_foundation
bayesian_search_foundation(
forecaster=forecaster_foundation, series=series, cv=cv,
search_space=lambda trial: {
'context_length': trial.suggest_categorical('context_length', [512, 2048])
},
metric='mean_absolute_error',
)
# ❌ WRONG: fit without residuals, then call predict_interval
forecaster.fit(y=y_train)
forecaster.predict_interval(steps=10, method='bootstrapping')
# ✅ CORRECT: store residuals during fit
forecaster.fit(y=y_train, store_in_sample_residuals=True)
forecaster.predict_interval(steps=10, method='bootstrapping')
| Forecaster | Supported Methods |
|---|---|
ForecasterRecursive | 'bootstrapping', 'conformal' |
ForecasterDirect | 'bootstrapping', 'conformal' |
ForecasterRecursiveMultiSeries | 'bootstrapping', 'conformal' (default: 'conformal') |
ForecasterDirectMultiVariate | 'bootstrapping', 'conformal' (default: 'conformal') |
ForecasterEquivalentDate | 'conformal' only |
ForecasterRnn | 'conformal' only |
ForecasterStats | Built-in (uses alpha or interval parameter, no method) |
ForecasterRecursiveClassifier | Not available — use predict_proba() |
# ❌ WRONG (deprecated Ets API)
ets_model = Ets(error='add', trend='add', seasonal='add', seasonal_periods=12)
# ✅ CORRECT (current API)
ets_model = Ets(model='AAA', m=12)
# Model string: 1st char=Error, 2nd=Trend, 3rd=Seasonal
# A=Additive, M=Multiplicative, N=None. Automatic selection only as model='ZZZ'
# (partial specs like 'ZZN' raise an error: use 'ZZZ' with seasonal=False, trend=...)
| Task | Single Series | Multi-Series | Statistical |
|---|---|---|---|
| Backtesting | backtesting_forecaster | backtesting_forecaster_multiseries | backtesting_stats |
| Grid Search | grid_search_forecaster | grid_search_forecaster_multiseries | grid_search_stats |
| Random Search | random_search_forecaster | random_search_forecaster_multiseries | random_search_stats |
| Bayesian Search | bayesian_search_forecaster | bayesian_search_forecaster_multiseries | N/A |
| Feature Selection | select_features | select_features_multiseries | N/A |
Forecasters saved (pickled/joblib) with older skforecast versions may fail to load or behave unexpectedly after upgrading. Internal attributes, class structures, and default values change between releases.
# ❌ Common error when loading a forecaster saved with an older version
import joblib
forecaster = joblib.load('forecaster_v0.13.pkl')
# AttributeError: 'ForecasterRecursive' object has no attribute 'new_attribute'
# or: ModuleNotFoundError: No module named 'skforecast.ForecasterAutoreg'
# ✅ CORRECT: retrain the forecaster with the current version
forecaster = ForecasterRecursive(
estimator=LGBMRegressor(),
lags=24,
)
forecaster.fit(y=y_train)
joblib.dump(forecaster, 'forecaster_v0.22.pkl')
Best practices:
requirements.txt for production deployments.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
17 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-forecasting/skforecast:troubleshooting-common-errorsfrom skforecast
npx claudepluginhub skforecast/skforecast --plugin skforecastOther plugins' skills for the same job