Files
foxhunt/archive/scripts/test_tft_logging.sh
jgrusewski 2df1ea92e1 feat(ml): WAVE 29 DQN Codebase Cleanup & Refactoring Campaign
BREAKING CHANGES:
- Removed orphaned dqn.rs monolithic trainer (4,975 lines)
- Removed orphaned dqn_ensemble.rs module (816 lines)
- Removed orphaned tft.rs and tft_complete_int8_integration_test.rs
- TFT trainer split into modular directory structure

DQN Module Refactoring:
- Split trainers/dqn.rs into modular structure (config.rs, statistics.rs, trainer.rs)
- Fixed hyperopt 39D search space (continuous params only)
- Boolean flags (use_dueling, use_double_dqn, use_per, use_noisy_nets) are now FIXED architectural decisions
- use_distributional defaults to false (Candle BUG #36 - scatter_add gradient issues)

Clean Module Structure:
- ml/src/trainers/dqn/ directory with proper mod.rs exports
- ml/src/trainers/tft/ directory with config.rs, types.rs, model.rs, trainer.rs, tests.rs
- All P0 features validated: TD-error clamping, batch diversity, LR scheduler, priority staleness

Documentation:
- Added comprehensive docs in docs/codebase-cleanup/
- ADR-001 for DQN refactoring decisions
- Rainbow DQN component matrix and quick reference guides

Build Status: Compiles with zero errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:46:13 +01:00

48 lines
1.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Test script to verify TFT logging reduction
# Runs 2 trials with 5 epochs each to verify log output reduction
set -e
echo "=== TFT Logging Reduction Test ==="
echo "Configuration: 2 trials, 5 epochs per trial"
echo ""
# Create temporary output file
OUTPUT_FILE=$(mktemp)
trap "rm -f $OUTPUT_FILE" EXIT
echo "Running hyperopt with logging capture..."
cargo run -p ml --example hyperopt_tft_demo --release --features cuda -- \
--parquet-file test_data/ES_FUT_180d.parquet \
--trials 2 \
--epochs 5 \
2>&1 | tee "$OUTPUT_FILE"
echo ""
echo "=== Log Analysis ==="
# Count different types of log lines
TOTAL_LINES=$(wc -l < "$OUTPUT_FILE")
EPOCH_LINES=$(grep -c "Epoch [0-9]*:" "$OUTPUT_FILE" || true)
TRAINING_TFT_LINES=$(grep -c "Training TFT:" "$OUTPUT_FILE" || true)
TRAINING_COMPLETED_LINES=$(grep -c "Training completed:" "$OUTPUT_FILE" || true)
TRAINING_DIRS_LINES=$(grep -c "Training directories created:" "$OUTPUT_FILE" || true)
PATHS_CONFIGURED_LINES=$(grep -c "TFT training paths configured:" "$OUTPUT_FILE" || true)
echo "Total log lines: $TOTAL_LINES"
echo "Epoch progress logs: $EPOCH_LINES (expected: ~2-4 with modulo 10 logging)"
echo "Training TFT parameter logs: $TRAINING_TFT_LINES (expected: 2, one per trial)"
echo "Training completed logs: $TRAINING_COMPLETED_LINES (expected: 2, one per trial)"
echo "Training directories logs: $TRAINING_DIRS_LINES (expected: 0 after consolidation)"
echo "Paths configured logs: $PATHS_CONFIGURED_LINES (expected: ~2, consolidated format)"
echo ""
echo "=== Expected Reduction ==="
echo "Before optimization: ~50 epoch logs (5 epochs × 2 trials × ~5 lines each)"
echo "After optimization: ~2-4 epoch logs (5 epochs × 2 trials / 10, info level only)"
echo "Total reduction: ~62.5% (Priority 1) + ~27.5% (Priority 2) = ~90% fewer log lines"
echo ""
echo "Test completed successfully!"