Skip to content

Release v0.1.0a11: API hardening, correctness fixes, beta prep - #1

Merged
stefan-jansen merged 3 commits into
mainfrom
release/v0.1.0a11
Mar 3, 2026
Merged

Release v0.1.0a11: API hardening, correctness fixes, beta prep#1
stefan-jansen merged 3 commits into
mainfrom
release/v0.1.0a11

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

Summary

  • Breaking: Rename QuantLabTAErrorML4TEngineerError, remove COMMON_PARAM_DEFAULTS, delete selection/systematic.py (→ ml4t-diagnostic), remove ml4t-style dependency
  • Correctness: Fix GARCH lookahead bias, trailing stop with ATR barriers, scaler column reordering, OHLCV schema validation
  • API: NaN validation at labeling entry points, group_col for trend_scanning_labels, validate_ohlcv_schema in compute_features
  • Cleanup: -2,123 lines (mypy comments, dead code, deprecated stubs)
  • Tests: +920 lines (catalog, experiment config, integration pipeline)

113 files changed, 1,306 insertions, 2,123 deletions. 3,199 tests passing.

Test plan

  • ruff check src/ — clean
  • ty check — clean
  • pytest tests/ — 3,199 passed, 1 skipped
  • All 120 features compute with default params
  • NaN validation catches bad data at labeling entry
  • Zero references to old exception names

…ness

Breaking changes (alpha, clean breaks):
- Rename QuantLabTAError → ML4TEngineerError, remove all deprecated aliases
- Remove COMMON_PARAM_DEFAULTS silent parameter fallback from compute_features
- Delete selection/systematic.py (moved to ml4t-diagnostic)
- Remove ml4t-style dependency

Correctness fixes:
- Fix GARCH forecast lookahead bias (was using future data for in-sample)
- Fix trailing_stop=True with column-name barriers (ATR barriers)
- Fix scaler column order preservation in StandardScaler/RobustScaler
- Fix validate_ohlcv_schema dtype check (use is_numeric() not hardcoded list)
- Fix TII value_range to (-100, 100) (indicator goes negative for downtrends)
- Fix experiment config YAML tuple serialization roundtrip

API improvements:
- Add NaN validation at all labeling entry points
- Add validate_ohlcv_schema guard in compute_features()
- Add group_col parameter to trend_scanning_labels() for panel data
- Add O(N*L) performance warning for atr_triple_barrier_labels
- Add parameters= defaults to sma/ema/wma/cyclical_encode/time_decay_weights
- Add BaseScaler.clone() method

Cleanup (-2123 lines net):
- Remove mypy: disable-error-code comments from ~50 feature files
- Delete unused _calculate_drawdowns_nb numba function
- Delete validate_numeric_column no-op
- Remove deprecated plot_feature_analysis_summary stub
- Remove coverage omissions for bars/microstructure

Tests (+920 lines):
- Add test_catalog.py (31 tests for FeatureCatalog)
- Add test_experiment_config.py (20 tests for ExperimentConfig)
- Add test_integration_pipeline.py (19 tests for end-to-end pipeline)
- Update existing tests for NaN validation behavior changes
Copilot AI review requested due to automatic review settings March 3, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This release (v0.1.0a11) hardens the API, fixes several correctness bugs, and removes large swaths of deprecated/dead code in preparation for a beta release. It is a breaking release: the base exception is renamed, COMMON_PARAM_DEFAULTS is removed, and selection/systematic.py is deleted.

Changes:

  • Breaking API changes: Rename QuantLabTAErrorML4TEngineerError, remove COMMON_PARAM_DEFAULTS (features without registered defaults now raise errors), move FeatureSelector to ml4t-diagnostic, delete selection/systematic.py.
  • Correctness fixes: Fix GARCH lookahead bias (always use conditional-expectation forecast), fix trailing-stop ATR barriers (raise error instead of silently using 1% default), fix scaler column reordering (iterate X.columns instead of _fitted_columns), add NaN validation at all labeling entry points, add group_col support to trend_scanning_labels.
  • New tests: 430 lines of integration pipeline tests, 234 lines of experiment config tests, 256 lines of catalog tests.

Reviewed changes

Copilot reviewed 113 out of 113 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ml4t/engineer/core/exceptions.py Rename base exception, remove all backward-compat aliases
src/ml4t/engineer/labeling/utils.py Add validate_price_no_nans utility
src/ml4t/engineer/labeling/triple_barrier.py Integrate NaN validation; fix trailing-stop error path; add label_bars/label_duration/barrier_hit to empty-group result
src/ml4t/engineer/labeling/horizon_labels.py Integrate NaN validation; refactor trend_scanning_labels to support group_col via new _trend_scanning_single_group helper
src/ml4t/engineer/labeling/atr_barriers.py Integrate NaN validation; add performance warning for large max_holding_bars=None
src/ml4t/engineer/labeling/calendar.py Add _session_breaks attribute initialization
src/ml4t/engineer/labeling/numba_ops.py Rename event_timesevent_indices; fix array dtypes (np.int64, np.int32)
src/ml4t/engineer/preprocessing.py Fix column-order bug in all three _apply_transform methods; add BaseScaler.clone(); handle empty series in MinMaxScaler/RobustScaler
src/ml4t/engineer/dataset.py Use clone() in cross-validation loop instead of manual attribute copying
src/ml4t/engineer/api.py Remove COMMON_PARAM_DEFAULTS; add validate_ohlcv_schema at entry; cleaner error for missing params
src/ml4t/engineer/config/experiment.py Add _tuples_to_lists for YAML roundtrip fidelity of tuples
src/ml4t/engineer/config/preprocessing_config.py Pass columns=self.columns to scaler constructors in create_scaler()
src/ml4t/engineer/core/schemas.py Use dtype.is_numeric() instead of explicit type list for OHLCV validation
src/ml4t/engineer/selection/__init__.py / systematic.py Remove FeatureSelector; add __getattr__ stub redirecting to ml4t-diagnostic
src/ml4t/engineer/visualization/__init__.py / summary.py Remove deprecated plot_feature_analysis_summary; simplify module docs
src/ml4t/engineer/features/… Remove mypy: disable-error-code comments across ~40 files; fix lookback/parameters metadata for sma, ema, wma, etc.
tests/test_integration_pipeline.py New end-to-end integration tests
tests/test_experiment_config.py New tests for experiment config load/save/roundtrip
tests/test_catalog.py New tests for FeatureCatalog API
tests/test_labeling.py / test_labeling_calendar.py / labeling/test_labeling_coverage.py Update NaN and trailing-stop tests to expect errors
tests/test_api.py Update feature tests for removed COMMON_PARAM_DEFAULTS
tests/selection/test_systematic.py / __init__.py Delete tests for removed module
pyproject.toml Remove coverage omissions for now-covered modules


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ml4t/engineer/labeling/horizon_labels.py
Comment thread src/ml4t/engineer/labeling/utils.py
Comment thread src/ml4t/engineer/preprocessing.py
@stefan-jansen
stefan-jansen merged commit 0b9e543 into main Mar 3, 2026
6 checks passed
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.

2 participants