Skip to content

[Refactor] Complete TSFit Removal - Enable Clean Multi-Backend Architecture #197

@astrogilda

Description

@astrogilda

Is your feature request related to a problem? Please describe.
TSFit represents significant technical debt that violates every core engineering principle in our standards:

  • Zero Tolerance for Technical Debt: TSFit IS technical debt - 400+ lines of duplicate code
  • Single Responsibility Principle: Handles 6+ responsibilities in one monolithic class
  • Performance: Creates 7.66x overhead compared to direct backend usage
  • Architecture: Blocks clean multi-backend design, limiting users to ~5 models instead of 30+

Current issues:

  • Duplicate implementations between TSFit and backend system
  • TSFitBestLag reimplements what StatsForecast's AutoARIMA already provides
  • Monolithic design prevents leveraging each backend's strengths
  • Forces all models through same interface, losing backend-specific optimizations

Describe the solution you'd like
Complete removal of TSFit in favor of the already-implemented multi-backend architecture:

  1. Phase 1: Add missing features to backends (AR support, HQIC, data rescaling)
  2. Phase 2: Add deprecation warnings to TSFit
  3. Phase 3: Migrate ~250 tests from TSFit to backends
  4. Phase 4: Remove TSFit implementation files
  5. Phase 5: Clean up all use_backend parameters and conditionals

End state - Clean multi-backend architecture:

├── StatsForecastBackend (30+ models, Auto*, batch optimization)
├── StatsModelsBackend (VAR/VECM, econometrics, diagnostics)
└── ArchBackend (GARCH family, volatility modeling)

Describe alternatives you've considered

  • Keep TSFit as legacy compatibility layer - violates Zero Tolerance for Technical Debt
  • Gradual deprecation over multiple versions - prolongs the architectural debt
  • Refactor TSFit to use backends internally - adds unnecessary abstraction layer

Additional context

  • TSFit is NOT used in production bootstrap code (only in tests)
  • Backend system already primary (use_backend=True by default)
  • Bootstrap classes use ModelFittingService, not TSFit directly
  • ~2,000 lines of code can be removed
  • Unlocks StatsForecast's full model suite (AutoETS, Theta, MSTL, etc.)

Benefits:

  • Performance: Maintain 7.66x speedup already achieved
  • Architecture: Enable specialized backends for different use cases
  • Maintainability: Single source of truth for each functionality
  • Future-proofing: Clear path for MLForecast/NeuralForecast integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions