Files
foxhunt/archive/scripts/deploy_ppo_hyperopt.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

60 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "========================================="
echo "PPO Hyperopt Deployment (CORRECTED OBJECTIVE)"
echo "========================================="
echo ""
# Configuration
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
OUTPUT_DIR="ppo_hyperopt_corrected_${TIMESTAMP}"
echo "Configuration:"
echo " Objective: Episode rewards (CORRECTED from validation loss)"
echo " Trials: 50"
echo " Episodes per trial: 2000"
echo " GPU: RTX A4000 ($0.25/hr)"
echo " Expected duration: 10-20 min"
echo " Expected cost: \$0.04-\$0.08"
echo " Output: /runpod-volume/ml_training/${OUTPUT_DIR}"
echo ""
# Verify Docker image contains fix
echo "Verifying Docker image..."
docker images jgrusewski/foxhunt-hyperopt:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.CreatedAt}}"
echo ""
# Check for .venv activation
if [[ -z "$VIRTUAL_ENV" ]]; then
echo "ERROR: Virtual environment not activated"
echo "Run: source .venv/bin/activate"
exit 1
fi
# Deploy PPO hyperopt with CORRECTED objective
echo "Deploying PPO hyperopt with CORRECTED objective function..."
python3 scripts/runpod_deploy.py \
--gpu-type "RTX A4000" \
--image "jgrusewski/foxhunt-hyperopt:latest" \
--command "hyperopt_ppo_demo --parquet-file /runpod-volume/test_data/ES_FUT_180d.parquet --trials 50 --episodes 2000 --base-dir /runpod-volume/ml_training/${OUTPUT_DIR} --early-stopping-min-epochs 50"
echo ""
echo "✅ PPO hyperopt deployment initiated (CORRECTED OBJECTIVE)"
echo ""
echo "CRITICAL FIX APPLIED:"
echo " Previous objective: val_policy_loss + val_value_loss (WRONG)"
echo " New objective: -avg_episode_reward (CORRECT)"
echo ""
echo "Expected Results:"
echo " Policy LR: Should vary widely (not stuck at 1e-6)"
echo " Value LR: Should optimize for actual learning"
echo " Episode rewards: Should maximize trading returns"
echo " Clip epsilon: Should find sweet spot for policy updates"
echo ""
echo "Next Steps:"
echo " 1. Monitor logs: python3 scripts/runpod_deploy.py --monitor <pod_id>"
echo " 2. Verify results in S3: aws s3 ls s3://se3zdnb5o4/models/ --profile runpod --recursive"
echo " 3. Compare hyperparameters to previous frozen policy (policy_lr=1e-6)"
echo ""