Fix performance issues related to memory usage during feature engineering - #183
Merged
ch55secake merged 5 commits intoApr 20, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/ch55secake/hyperion/sessions/80782c30-a563-4add-8966-f9ce65052b7d Co-authored-by: ch55secake <87881861+ch55secake@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ch55secake/hyperion/sessions/7f21cd39-69a3-4b1d-8071-b45abf428ded Co-authored-by: ch55secake <87881861+ch55secake@users.noreply.github.com>
Owner
|
@copilot Run ruff format . |
Agent-Logs-Url: https://github.com/ch55secake/hyperion/sessions/8eb2d025-fe63-4e38-9e1b-08f07ce307ad Co-authored-by: ch55secake <87881861+ch55secake@users.noreply.github.com>
Contributor
Author
Done — |
ch55secake
deleted the
copilot/reduce-memory-footprint-feature-engineering
branch
April 20, 2026 21:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Holding all raw OHLCV data, per-ticker engineered features, and concatenated train/test frames simultaneously causes significant memory pressure for large ticker universes. This PR cuts peak memory by ~50%+ through dtype downcasting and explicit object lifetime management.
Changes in this pull request
feature_engineering.py—prepare_features()downcasts all float64 feature columns to float32 after matrix constructionbase_pipeline.py—_add_stock_features()writesbeta,avg_volume_log,market_cap_logasnp.float32scalars so no float64 leaks into the final matrixstacked_pipeline.py— setsself._stock_data = Nonepost feature-engineering loop; clears each per-ticker list immediately after itspd.concattest_numeric_feature_columns_are_float32,test_categorical_columns_not_downcast,test_feature_matrix_uses_float32,test_stock_data_freed_after_prepare_featurestests/model/test_stacked_pipeline.py— reformatted withruff format .