Skip to content

Refactor univariate drift detection: centralize functionality in class and remove standalone functions #118

@EH-MLS

Description

@EH-MLS

The current implementation of tab_right/drift/univariate.py contains both a UnivariateDriftCalculator class and several standalone functions for univariate drift detection (e.g., detect_univariate_drift_with_options, detect_univariate_drift, detect_univariate_drift_df). This leads to duplicated logic and a lack of cohesion.

Proposed refactor:

  • Move all functional logic into the UnivariateDriftCalculator class.
  • Remove standalone functions and expose their features as class/static methods or instance methods as appropriate.
  • Ensure all API use-cases are covered by the class (including backward compatibility where possible).
  • Update docstrings and usage examples to reflect the new, centralized API.
  • Add or update tests to verify that the refactored class covers all previous functionality.

Benefits:

  • Improved maintainability and cohesion by following OOP principles.
  • Centralized drift calculation logic.
  • Easier to extend and maintain drift detection code in the future.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions