Skip to content

fix: detect forecaster-chain as invalid in sequential pipeline validation#457

Open
kpal002 wants to merge 1 commit into
sktime:mainfrom
kpal002:fix/validator-forecaster-chain-detection
Open

fix: detect forecaster-chain as invalid in sequential pipeline validation#457
kpal002 wants to merge 1 commit into
sktime:mainfrom
kpal002:fix/validator-forecaster-chain-detection

Conversation

@kpal002
Copy link
Copy Markdown

@kpal002 kpal002 commented May 17, 2026

Reference Issues/PRs

Fixes #445.

What does this implement/fix? Explain your changes.

Root cause: COMPOSITION_RULES contains an ENSEMBLE rule (forecasting → forecasting, position="any") which matched the NaiveForecaster → ExponentialSmoothing pair during sequential pipeline validation. Because an applicable rule was found, the explicit forecaster-chain error check in _check_pair_compatibility was never reached, causing the validator to return valid=True.

Fix in src/sktime_mcp/composition/validator.py:

  1. Added an early-return guard in _check_pair_compatibility for forecasting → forecasting pairs before the rule lookup. Two forecasters in a sequential pipeline are always invalid — ENSEMBLE composition is parallel, not sequential.

  2. Added and rule.composition_type != CompositionType.ENSEMBLE to the rule-matching condition to make it explicit that ENSEMBLE-type rules should not be used to approve sequential pipeline pairs.

Result: validate_pipeline(["NaiveForecaster", "ExponentialSmoothing"]) now correctly returns valid=False with the error:

Cannot chain forecasters 'NaiveForecaster' → 'ExponentialSmoothing' directly. Use an ensemble or multiplexer instead.

This matches the icon and # Invalid pipeline: Forecaster -> Forecaster comment in examples/01_forecasting_workflow.py Step 5.

Does your contribution introduce a new dependency? If yes, which one?

No.

What should a reviewer concentrate their feedback on?

  • The early-return guard in _check_pair_compatibility (lines 262–271) — confirm that sequential forecaster chaining should always be invalid with no exceptions.
  • The CompositionType.ENSEMBLE filter in the rule lookup — confirm that ENSEMBLE rules should never apply in a sequential pipeline context.

Any other comments?

No new dependencies. No API changes. The fix is purely internal to _check_pair_compatibility.

PR checklist

For all contributions
  • I've added myself to the list of contributors.
  • Optionally, I've updated sktime's CODEOWNERS to receive notifications about future changes to these files.
  • I've added unit tests and made sure they pass locally.

…tion

The ENSEMBLE composition rule (forecasting → forecasting, position="any")
was matching during validate_pipeline(), causing the explicit forecaster-chain
error to be silently skipped. Two forecasters in a sequential pipeline are
always invalid — ENSEMBLE composition is parallel, not sequential.

Fixes: forecaster → forecaster pair returns Valid: True in Step 5 of
examples/01_forecasting_workflow.py when it should return Valid: False.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Example 01: hardcoded ❌ icon conflicts with validator returning Valid: True

2 participants