Skip to content

Daily Audit 2026-04-25: logging violations, CatBoost optimization bug, global warning suppression, DataFrame fragmentation - #207

Draft
ch55secake with Copilot wants to merge 2 commits into
mainfrom
copilot/daily-audit-2026-04-25
Draft

Daily Audit 2026-04-25: logging violations, CatBoost optimization bug, global warning suppression, DataFrame fragmentation#207
ch55secake with Copilot wants to merge 2 commits into
mainfrom
copilot/daily-audit-2026-04-25

Conversation

Copilot AI commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Description

Four new issues found during the 2026-04-25 codebase audit — not covered by any existing open issue — across logging, ML correctness, and performance categories.

Changes in this pull request

  • Logging violations (base_pipeline.py, stacked_pipeline.py): traceback.print_exc() was called alongside logger.error() in exception handlers, violating the no-print() rule. Replaced with logger.exception() (logs at ERROR level + full traceback). Removed now-unused import traceback in both files.

  • CatBoost optimization silently used LightGBM params (single_pipeline.py): _optimize_hyperparameters() had an if xgboost / else lightgbm structure — any model_type other than "xgboost" (including "catboost") ran LightGBM Optuna trials and passed those params to the model. Fixed with explicit if/elif/else; unsupported types now log a WARNING and fall back to defaults.

    # Before — catboost silently received LightGBM hyperparameters
    if self.model_type == "xgboost":
        optimizer.optimize_xgboost(); self._model_params = optimizer.best_xgb_params
    else:
        optimizer.optimize_lightgbm(); self._model_params = optimizer.best_lgb_params
    
    # After
    if self.model_type == "xgboost":
        optimizer.optimize_xgboost(); self._model_params = optimizer.best_xgb_params
    elif self.model_type == "lightgbm":
        optimizer.optimize_lightgbm(); self._model_params = optimizer.best_lgb_params
    else:
        logger.warning("Hyperparameter optimisation is not supported for model_type='%s'. ...", self.model_type)
  • Global warnings.filterwarnings('ignore') in main.py: Separate untracked occurrence of the pattern already captured in Performance: warnings.filterwarnings('ignore') suppresses all warnings globally #103 for optimizer.py. Removed.

  • DataFrame fragmentation (feature_engineering.py, base_pipeline.py): add_all_technical_indicators() inserts ~130 columns one-by-one, causing pandas PerformanceWarning: DataFrame is highly fragmented at lines 282, 289, and 293. Added self.df = self.df.copy() midway to consolidate blocks before late indicators. Also refactored _add_stock_features() from 6 individual column assignments to a single pd.concat. Test-suite PerformanceWarnings dropped from 1503 → 29.

Copilot AI linked an issue Apr 25, 2026 that may be closed by this pull request
…bal warning suppression, DataFrame fragmentation

Agent-Logs-Url: https://github.com/ch55secake/hyperion/sessions/de5aec33-6ed5-4a1e-8ab1-062876a6139b

Co-authored-by: ch55secake <87881861+ch55secake@users.noreply.github.com>
Copilot AI changed the title [WIP] Audit Hyperion codebase for bugs and performance Daily Audit 2026-04-25: logging violations, CatBoost optimization bug, global warning suppression, DataFrame fragmentation Apr 25, 2026
Copilot AI requested a review from ch55secake April 25, 2026 08:29
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.

Daily Audit: 2026-04-25

2 participants