Skip to content

fix: handle empty features_in gracefully + initialize in __init__#24

Open
IABrain wants to merge 1 commit into
emergentmethods:mainfrom
IABrain:fix/pipeline-features-in-empty-13167
Open

fix: handle empty features_in gracefully + initialize in __init__#24
IABrain wants to merge 1 commit into
emergentmethods:mainfrom
IABrain:fix/pipeline-features-in-empty-13167

Conversation

@IABrain

@IABrain IABrain commented May 23, 2026

Copy link
Copy Markdown

Fixes freqtrade issue #13167 where FreqAI users hit:
AttributeError: 'Pipeline' object has no attribute 'features_in'

and then:
Exception: Pipeline expected [] but got Index([...])

Changes:

  1. Initialize self.features_in = [] in init alongside self.feature_list
  2. In _validate_arguments DataFrame predict branch: if features_in is empty, gracefully populate from the first transform call instead of raising
  3. Add 2 regression tests for both scenarios

This unblocks FreqAI backtesting (XGBoostRegressor + LightGBMRegressor) without requiring manual installed-copy patches.

Reported and verified by: TradingIA team (freqtrade #13167)

Fixes freqtrade issue #13167 where FreqAI users hit:
  AttributeError: 'Pipeline' object has no attribute 'features_in'

and then:
  Exception: Pipeline expected [] but got Index([...])

Changes:
1. Initialize self.features_in = [] in __init__ alongside self.feature_list
2. In _validate_arguments DataFrame predict branch: if features_in is empty,
   gracefully populate from the first transform call instead of raising
3. Add 2 regression tests for both scenarios

This unblocks FreqAI backtesting (XGBoostRegressor + LightGBMRegressor)
without requiring manual installed-copy patches.

Reported and verified by: TradingIA team (freqtrade #13167)
@IABrain

IABrain commented May 23, 2026

Copy link
Copy Markdown
Author

Production verification

This PR has been verified working in production by the TradingIA team:

Before fix

File "datasieve/pipeline.py", line 92, in transform
  X, y, sample_weight = self._validate_arguments(...)
File "datasieve/pipeline.py", line 167, in _validate_arguments
  if list(X.columns) != list(self.features_in):
AttributeError: 'Pipeline' object has no attribute 'features_in'

After fix

  • freqtrade backtesting --freqaimodel XGBoostRegressor completes end-to-end (36 trades, 9 months BTC/USDT 1d)
  • freqtrade backtesting --freqaimodel LightGBMRegressor completes
  • ✅ Model training + predict pipeline runs without exceptions
  • ✅ No regressions in existing pipeline tests

Cross-reference

Happy to address any review feedback.

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.

1 participant