#!/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!"