commit before i move to new user

This commit is contained in:
2025-02-12 23:07:05 +00:00
parent 2a8f9730d7
commit 40629fec10
6 changed files with 121454 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -476,3 +476,279 @@
2025-02-04 23:04:50,893 - INFO - Final DQN agent trained and saved.
2025-02-04 23:04:50,893 - INFO - Running final inference with the trained DQN model...
2025-02-04 23:31:28,534 - INFO - Final inference completed. Results logged and displayed.
2025-02-06 00:35:56,485 - INFO - ===== Resource Statistics =====
2025-02-06 00:35:56,485 - INFO - Physical CPU Cores: 28
2025-02-06 00:35:56,485 - INFO - Logical CPU Cores: 56
2025-02-06 00:35:56,485 - INFO - CPU Usage per Core: [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0]%
2025-02-06 00:35:56,485 - INFO - No GPUs detected.
2025-02-06 00:35:56,485 - INFO - =================================
2025-02-06 00:35:56,486 - INFO - Configured TensorFlow to use CPU with optimized thread settings.
2025-02-06 00:35:56,486 - INFO - Loading data from: SQ_5min_3years.csv
2025-02-06 00:35:57,097 - INFO - Data columns after renaming: ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']
2025-02-06 00:35:57,102 - INFO - Data loaded and sorted successfully.
2025-02-06 00:35:57,102 - INFO - Calculating technical indicators...
2025-02-06 00:35:57,176 - INFO - Technical indicators calculated successfully.
2025-02-06 00:35:57,194 - INFO - Starting parallel feature engineering with 54 workers...
2025-02-06 00:36:18,057 - INFO - Parallel feature engineering completed.
2025-02-06 00:36:18,285 - INFO - Scaled training features shape: (42387, 15, 17)
2025-02-06 00:36:18,285 - INFO - Scaled validation features shape: (9083, 15, 17)
2025-02-06 00:36:18,285 - INFO - Scaled testing features shape: (9084, 15, 17)
2025-02-06 00:36:18,285 - INFO - Scaled training target shape: (42387,)
2025-02-06 00:36:18,285 - INFO - Scaled validation target shape: (9083,)
2025-02-06 00:36:18,285 - INFO - Scaled testing target shape: (9084,)
2025-02-06 00:36:18,285 - INFO - Starting LSTM hyperparameter optimization with Optuna using 54 parallel trials...
2025-02-06 05:46:48,709 - INFO - Best LSTM Hyperparameters: {'num_lstm_layers': 1, 'lstm_units': 96, 'dropout_rate': 0.37358665126633106, 'learning_rate': 0.0008426659064100389, 'optimizer': 'Nadam', 'decay': 2.2589194255681924e-05}
2025-02-06 05:46:48,928 - INFO - Training best LSTM model with optimized hyperparameters...
2025-02-06 08:39:04,795 - INFO - Evaluating final LSTM model...
2025-02-06 08:39:07,299 - INFO - Test MSE: 0.1205
2025-02-06 08:39:07,299 - INFO - Test RMSE: 0.3471
2025-02-06 08:39:07,299 - INFO - Test MAE: 0.2337
2025-02-06 08:39:07,299 - INFO - Test R2 Score: 0.9992
2025-02-06 08:39:07,299 - INFO - Directional Accuracy: 0.4256
2025-02-06 08:39:07,586 - WARNING - You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`.
2025-02-06 08:39:07,616 - INFO - Saved best LSTM model and scaler objects (best_lstm_model.h5, scaler_features.pkl, scaler_target.pkl).
2025-02-06 08:39:07,616 - INFO - Training DQN agent: Attempt 1 with hyperparameters: {'lr': 0.001, 'gamma': 0.95, 'exploration_fraction': 0.1, 'buffer_size': 10000, 'batch_size': 64}
2025-02-06 11:03:33,484 - INFO - Agent achieved final net worth: $10000.00
2025-02-06 11:03:33,484 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-06 11:03:33,485 - INFO - Training DQN agent: Attempt 2 with hyperparameters: {'lr': 0.0009000000000000001, 'gamma': 0.95, 'exploration_fraction': 0.12000000000000001, 'buffer_size': 10000, 'batch_size': 64}
2025-02-06 13:30:35,637 - INFO - Agent achieved final net worth: $10000.00
2025-02-06 13:30:35,637 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-06 13:30:35,637 - INFO - Training DQN agent: Attempt 3 with hyperparameters: {'lr': 0.0008100000000000001, 'gamma': 0.95, 'exploration_fraction': 0.14, 'buffer_size': 10000, 'batch_size': 64}
2025-02-06 15:58:18,063 - INFO - Agent achieved final net worth: $10000.00
2025-02-06 15:58:18,064 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-06 15:58:18,064 - INFO - Training DQN agent: Attempt 4 with hyperparameters: {'lr': 0.000729, 'gamma': 0.95, 'exploration_fraction': 0.16, 'buffer_size': 10000, 'batch_size': 64}
2025-02-06 18:25:38,932 - INFO - Agent achieved final net worth: $10000.00
2025-02-06 18:25:38,933 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-06 18:25:38,933 - INFO - Training DQN agent: Attempt 5 with hyperparameters: {'lr': 0.0006561000000000001, 'gamma': 0.95, 'exploration_fraction': 0.18, 'buffer_size': 10000, 'batch_size': 64}
2025-02-06 20:53:28,087 - INFO - Agent achieved final net worth: $13898.81
2025-02-06 20:53:28,087 - INFO - Agent meets performance criteria!
2025-02-06 20:53:28,095 - INFO - Final DQN agent trained and saved.
2025-02-06 20:53:28,095 - INFO - Running final inference with the trained DQN model...
2025-02-06 22:13:39,698 - INFO - Final inference completed. Results logged and displayed.
2025-02-08 03:18:28,923 - INFO - ===== Resource Statistics =====
2025-02-08 03:18:28,923 - INFO - Physical CPU Cores: 28
2025-02-08 03:18:28,923 - INFO - Logical CPU Cores: 56
2025-02-08 03:18:28,923 - INFO - CPU Usage per Core: [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]%
2025-02-08 03:18:28,923 - INFO - No GPUs detected.
2025-02-08 03:18:28,923 - INFO - =================================
2025-02-08 03:18:28,924 - INFO - Configured TensorFlow to use CPU with optimized thread settings.
2025-02-08 03:18:28,924 - INFO - Loading data from: AMD_5min_3years.csv
2025-02-08 03:18:28,927 - ERROR - Unexpected error: Missing column provided to 'parse_dates': 'time'
2025-02-08 20:35:01,077 - INFO - ===== Resource Statistics =====
2025-02-08 20:35:01,077 - INFO - Physical CPU Cores: 28
2025-02-08 20:35:01,077 - INFO - Logical CPU Cores: 56
2025-02-08 20:35:01,077 - INFO - CPU Usage per Core: [1.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]%
2025-02-08 20:35:01,077 - INFO - No GPUs detected.
2025-02-08 20:35:01,077 - INFO - =================================
2025-02-08 20:35:01,078 - INFO - Configured TensorFlow to use CPU with optimized thread settings.
2025-02-08 20:35:01,078 - INFO - Loading data from: AMD_5min_3years.csv
2025-02-08 20:35:01,588 - INFO - Data columns after renaming: ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']
2025-02-08 20:35:01,591 - INFO - Data loaded and sorted successfully.
2025-02-08 20:35:01,591 - INFO - Calculating technical indicators...
2025-02-08 20:35:01,646 - INFO - Technical indicators calculated successfully.
2025-02-08 20:35:01,662 - INFO - Starting parallel feature engineering with 54 workers...
2025-02-08 20:35:23,732 - INFO - Parallel feature engineering completed.
2025-02-08 20:35:23,987 - INFO - Scaled training features shape: (42387, 15, 17)
2025-02-08 20:35:23,987 - INFO - Scaled validation features shape: (9083, 15, 17)
2025-02-08 20:35:23,987 - INFO - Scaled testing features shape: (9084, 15, 17)
2025-02-08 20:35:23,987 - INFO - Scaled training target shape: (42387,)
2025-02-08 20:35:23,987 - INFO - Scaled validation target shape: (9083,)
2025-02-08 20:35:23,987 - INFO - Scaled testing target shape: (9084,)
2025-02-08 20:35:23,987 - INFO - Starting LSTM hyperparameter optimization with Optuna using 54 parallel trials...
2025-02-08 22:37:34,785 - INFO - Best LSTM Hyperparameters: {'num_lstm_layers': 1, 'lstm_units': 96, 'dropout_rate': 0.13760623474547576, 'learning_rate': 0.004649331506930878, 'optimizer': 'Nadam', 'decay': 6.111945392322344e-05}
2025-02-08 22:37:35,014 - INFO - Training best LSTM model with optimized hyperparameters...
2025-02-08 23:24:26,655 - INFO - Evaluating final LSTM model...
2025-02-08 23:24:28,990 - INFO - Test MSE: 0.2720
2025-02-08 23:24:28,990 - INFO - Test RMSE: 0.5215
2025-02-08 23:24:28,990 - INFO - Test MAE: 0.3292
2025-02-08 23:24:28,990 - INFO - Test R2 Score: 0.9986
2025-02-08 23:24:28,990 - INFO - Directional Accuracy: 0.4286
2025-02-08 23:24:29,306 - WARNING - You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`.
2025-02-08 23:24:29,336 - INFO - Saved best LSTM model and scaler objects (best_lstm_model.h5, scaler_features.pkl, scaler_target.pkl).
2025-02-08 23:24:29,337 - INFO - Training DQN agent: Attempt 1 with hyperparameters: {'lr': 0.001, 'gamma': 0.95, 'exploration_fraction': 0.1, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 01:47:20,221 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 01:47:20,221 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 01:47:20,221 - INFO - Training DQN agent: Attempt 2 with hyperparameters: {'lr': 0.0009000000000000001, 'gamma': 0.95, 'exploration_fraction': 0.12000000000000001, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 04:13:26,314 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 04:13:26,315 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 04:13:26,315 - INFO - Training DQN agent: Attempt 3 with hyperparameters: {'lr': 0.0008100000000000001, 'gamma': 0.95, 'exploration_fraction': 0.14, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 06:40:02,398 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 06:40:02,398 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 06:40:02,398 - INFO - Training DQN agent: Attempt 4 with hyperparameters: {'lr': 0.000729, 'gamma': 0.95, 'exploration_fraction': 0.16, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 09:06:34,165 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 09:06:34,165 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 09:06:34,165 - INFO - Training DQN agent: Attempt 5 with hyperparameters: {'lr': 0.0006561000000000001, 'gamma': 0.95, 'exploration_fraction': 0.18, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 11:33:11,575 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 11:33:11,575 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 11:33:11,575 - INFO - Training DQN agent: Attempt 6 with hyperparameters: {'lr': 0.00059049, 'gamma': 0.95, 'exploration_fraction': 0.19999999999999998, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 13:59:47,179 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 13:59:47,179 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 13:59:47,179 - INFO - Training DQN agent: Attempt 7 with hyperparameters: {'lr': 0.000531441, 'gamma': 0.95, 'exploration_fraction': 0.21999999999999997, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 16:26:06,038 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 16:26:06,038 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 16:26:06,038 - INFO - Training DQN agent: Attempt 8 with hyperparameters: {'lr': 0.0004782969, 'gamma': 0.95, 'exploration_fraction': 0.23999999999999996, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 18:52:25,244 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 18:52:25,244 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 18:52:25,244 - INFO - Training DQN agent: Attempt 9 with hyperparameters: {'lr': 0.00043046721, 'gamma': 0.95, 'exploration_fraction': 0.25999999999999995, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 21:18:51,701 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 21:18:51,701 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 21:18:51,702 - INFO - Training DQN agent: Attempt 10 with hyperparameters: {'lr': 0.000387420489, 'gamma': 0.95, 'exploration_fraction': 0.27999999999999997, 'buffer_size': 10000, 'batch_size': 64}
2025-02-09 23:45:25,714 - INFO - Agent achieved final net worth: $10000.00
2025-02-09 23:45:25,715 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-09 23:45:25,715 - WARNING - Failed to train a satisfactory DQN agent after multiple attempts. Using last trained model
2025-02-09 23:45:25,715 - INFO - Running final inference with the trained DQN model...
2025-02-10 01:04:44,394 - INFO - Final inference completed. Results logged and displayed.
2025-02-10 01:04:44,394 - WARNING - Final net worth ($10000.00) is below $10500.00. Retraining the same DQN model to learn from mistakes...
2025-02-10 01:04:44,394 - INFO - Retraining the existing DQN model for an additional 50000 timesteps (keeping old experiences).
2025-02-10 01:59:27,198 - INFO - ===== Resource Statistics =====
2025-02-10 01:59:27,198 - INFO - Physical CPU Cores: 28
2025-02-10 01:59:27,198 - INFO - Logical CPU Cores: 56
2025-02-10 01:59:27,198 - INFO - CPU Usage per Core: [1.0, 0.0, 0.0, 3.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]%
2025-02-10 01:59:27,198 - INFO - No GPUs detected.
2025-02-10 01:59:27,198 - INFO - =================================
2025-02-10 01:59:27,199 - INFO - Configured TensorFlow to use CPU with optimized thread settings.
2025-02-10 01:59:27,199 - INFO - Loading data from: BAT.csv
2025-02-10 01:59:28,219 - INFO - Data columns after renaming: ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']
2025-02-10 01:59:28,236 - INFO - Data loaded and sorted successfully.
2025-02-10 01:59:28,236 - INFO - Calculating technical indicators...
2025-02-10 01:59:28,273 - INFO - Technical indicators calculated successfully.
2025-02-10 01:59:28,283 - INFO - Starting parallel feature engineering with 54 workers...
2025-02-10 01:59:36,985 - INFO - Parallel feature engineering completed.
2025-02-10 01:59:37,072 - INFO - Scaled training features shape: (14134, 15, 17)
2025-02-10 01:59:37,072 - INFO - Scaled validation features shape: (3028, 15, 17)
2025-02-10 01:59:37,072 - INFO - Scaled testing features shape: (3030, 15, 17)
2025-02-10 01:59:37,072 - INFO - Scaled training target shape: (14134,)
2025-02-10 01:59:37,073 - INFO - Scaled validation target shape: (3028,)
2025-02-10 01:59:37,073 - INFO - Scaled testing target shape: (3030,)
2025-02-10 01:59:37,073 - INFO - Starting LSTM hyperparameter optimization with Optuna using 54 parallel trials...
2025-02-10 03:44:02,784 - INFO - Best LSTM Hyperparameters: {'num_lstm_layers': 1, 'lstm_units': 128, 'dropout_rate': 0.11889682795544095, 'learning_rate': 0.006130487869147621, 'optimizer': 'Adam', 'decay': 2.0781962679815092e-05}
2025-02-10 03:44:03,015 - INFO - Training best LSTM model with optimized hyperparameters...
2025-02-10 05:00:33,998 - INFO - Evaluating final LSTM model...
2025-02-10 05:00:36,237 - INFO - Test MSE: 0.0749
2025-02-10 05:00:36,238 - INFO - Test RMSE: 0.2738
2025-02-10 05:00:36,238 - INFO - Test MAE: 0.1693
2025-02-10 05:00:36,238 - INFO - Test R2 Score: 0.9938
2025-02-10 05:00:36,238 - INFO - Directional Accuracy: 0.4833
2025-02-10 05:00:36,744 - WARNING - You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`.
2025-02-10 05:00:36,802 - INFO - Saved best LSTM model and scaler objects (best_lstm_model.h5, scaler_features.pkl, scaler_target.pkl).
2025-02-10 05:00:36,802 - INFO - Training DQN agent: Attempt 1 with hyperparameters: {'lr': 0.001, 'gamma': 0.95, 'exploration_fraction': 0.1, 'buffer_size': 10000, 'batch_size': 64}
2025-02-10 06:34:16,080 - INFO - Agent achieved final net worth: $10700.22
2025-02-10 06:34:16,081 - INFO - Agent meets performance criteria!
2025-02-10 06:34:16,089 - INFO - Final DQN agent trained and saved.
2025-02-10 06:34:16,089 - INFO - Running final inference with the trained DQN model...
2025-02-10 07:01:03,503 - INFO - Final inference completed. Results logged and displayed.
2025-02-10 17:01:10,348 - INFO - ===== Resource Statistics =====
2025-02-10 17:01:10,349 - INFO - Physical CPU Cores: 28
2025-02-10 17:01:10,349 - INFO - Logical CPU Cores: 56
2025-02-10 17:01:10,349 - INFO - CPU Usage per Core: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]%
2025-02-10 17:01:10,349 - INFO - No GPUs detected.
2025-02-10 17:01:10,349 - INFO - =================================
2025-02-10 17:01:10,349 - INFO - Configured TensorFlow to use CPU with optimized thread settings.
2025-02-10 17:01:10,349 - INFO - Loading data from: AMD_5min_3years.csv
2025-02-10 17:01:10,870 - INFO - Data columns after renaming: ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']
2025-02-10 17:01:10,873 - INFO - Data loaded and sorted successfully.
2025-02-10 17:01:10,874 - INFO - Calculating technical indicators...
2025-02-10 17:01:10,927 - INFO - Technical indicators calculated successfully.
2025-02-10 17:01:10,942 - INFO - Starting parallel feature engineering with 54 workers...
2025-02-10 17:01:33,340 - INFO - Parallel feature engineering completed.
2025-02-10 17:01:33,595 - INFO - Scaled training features shape: (42387, 15, 17)
2025-02-10 17:01:33,595 - INFO - Scaled validation features shape: (9083, 15, 17)
2025-02-10 17:01:33,595 - INFO - Scaled testing features shape: (9084, 15, 17)
2025-02-10 17:01:33,595 - INFO - Scaled training target shape: (42387,)
2025-02-10 17:01:33,596 - INFO - Scaled validation target shape: (9083,)
2025-02-10 17:01:33,596 - INFO - Scaled testing target shape: (9084,)
2025-02-10 17:01:33,596 - INFO - Starting LSTM hyperparameter optimization with Optuna using 54 parallel trials...
2025-02-10 18:31:51,553 - INFO - Best LSTM Hyperparameters: {'num_lstm_layers': 1, 'lstm_units': 96, 'dropout_rate': 0.24709594107780505, 'learning_rate': 0.0004354416238951122, 'optimizer': 'Adam', 'decay': 6.919767701228614e-05}
2025-02-10 18:31:51,847 - INFO - Training best LSTM model with optimized hyperparameters...
2025-02-10 19:36:12,675 - INFO - Evaluating final LSTM model...
2025-02-10 19:36:15,181 - INFO - Test MSE: 0.4216
2025-02-10 19:36:15,181 - INFO - Test RMSE: 0.6493
2025-02-10 19:36:15,182 - INFO - Test MAE: 0.4030
2025-02-10 19:36:15,182 - INFO - Test R2 Score: 0.9979
2025-02-10 19:36:15,182 - INFO - Directional Accuracy: 0.4296
2025-02-10 19:36:15,495 - WARNING - You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`.
2025-02-10 19:36:15,527 - INFO - Saved best LSTM model and scaler objects (best_lstm_model.h5, scaler_features.pkl, scaler_target.pkl).
2025-02-10 19:36:15,527 - INFO - Training DQN agent: Attempt 1 with hyperparameters: {'lr': 0.001, 'gamma': 0.95, 'exploration_fraction': 0.1, 'buffer_size': 10000, 'batch_size': 64}
2025-02-10 22:00:22,071 - INFO - Agent achieved final net worth: $10000.00
2025-02-10 22:00:22,071 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-10 22:00:22,071 - INFO - Training DQN agent: Attempt 2 with hyperparameters: {'lr': 0.0009000000000000001, 'gamma': 0.95, 'exploration_fraction': 0.12000000000000001, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 00:28:18,890 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 00:28:18,890 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 00:28:18,890 - INFO - Training DQN agent: Attempt 3 with hyperparameters: {'lr': 0.0008100000000000001, 'gamma': 0.95, 'exploration_fraction': 0.14, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 02:56:07,619 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 02:56:07,620 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 02:56:07,620 - INFO - Training DQN agent: Attempt 4 with hyperparameters: {'lr': 0.000729, 'gamma': 0.95, 'exploration_fraction': 0.16, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 05:24:17,114 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 05:24:17,114 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 05:24:17,115 - INFO - Training DQN agent: Attempt 5 with hyperparameters: {'lr': 0.0006561000000000001, 'gamma': 0.95, 'exploration_fraction': 0.18, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 07:55:08,453 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 07:55:08,453 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 07:55:08,453 - INFO - Training DQN agent: Attempt 6 with hyperparameters: {'lr': 0.00059049, 'gamma': 0.95, 'exploration_fraction': 0.19999999999999998, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 10:23:23,567 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 10:23:23,568 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 10:23:23,568 - INFO - Training DQN agent: Attempt 7 with hyperparameters: {'lr': 0.000531441, 'gamma': 0.95, 'exploration_fraction': 0.21999999999999997, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 12:52:22,787 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 12:52:22,788 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 12:52:22,788 - INFO - Training DQN agent: Attempt 8 with hyperparameters: {'lr': 0.0004782969, 'gamma': 0.95, 'exploration_fraction': 0.23999999999999996, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 15:20:58,270 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 15:20:58,270 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 15:20:58,271 - INFO - Training DQN agent: Attempt 9 with hyperparameters: {'lr': 0.00043046721, 'gamma': 0.95, 'exploration_fraction': 0.25999999999999995, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 17:49:15,124 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 17:49:15,125 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 17:49:15,125 - INFO - Training DQN agent: Attempt 10 with hyperparameters: {'lr': 0.000387420489, 'gamma': 0.95, 'exploration_fraction': 0.27999999999999997, 'buffer_size': 10000, 'batch_size': 64}
2025-02-11 20:17:57,424 - INFO - Agent achieved final net worth: $10000.00
2025-02-11 20:17:57,424 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-11 20:17:57,424 - WARNING - Failed to train a satisfactory DQN agent after multiple attempts. Using last trained model
2025-02-11 20:17:57,425 - INFO - Running final inference with the trained DQN model...
2025-02-11 21:38:23,293 - INFO - Final inference completed. Results logged and displayed.
2025-02-11 21:38:23,293 - WARNING - Final net worth ($10000.00) is below $10500.00. Retraining the same DQN model to learn from mistakes...
2025-02-11 21:38:23,293 - INFO - Retraining the existing DQN model for an additional 50000 timesteps (keeping old experiences).
2025-02-12 06:02:31,338 - INFO - ===== Resource Statistics =====
2025-02-12 06:02:31,339 - INFO - Physical CPU Cores: 28
2025-02-12 06:02:31,339 - INFO - Logical CPU Cores: 56
2025-02-12 06:02:31,339 - INFO - CPU Usage per Core: [2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]%
2025-02-12 06:02:31,339 - INFO - No GPUs detected.
2025-02-12 06:02:31,339 - INFO - =================================
2025-02-12 06:02:31,340 - INFO - Configured TensorFlow to use CPU with optimized thread settings.
2025-02-12 06:02:31,340 - INFO - Loading data from: BAT.csv
2025-02-12 06:02:32,963 - INFO - Data columns after renaming: ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']
2025-02-12 06:02:32,980 - INFO - Data loaded and sorted successfully.
2025-02-12 06:02:32,981 - INFO - Calculating technical indicators...
2025-02-12 06:02:33,017 - INFO - Technical indicators calculated successfully.
2025-02-12 06:02:33,027 - INFO - Starting parallel feature engineering with 54 workers...
2025-02-12 06:02:42,076 - INFO - Parallel feature engineering completed.
2025-02-12 06:02:42,182 - INFO - Scaled training features shape: (14134, 15, 17)
2025-02-12 06:02:42,182 - INFO - Scaled validation features shape: (3028, 15, 17)
2025-02-12 06:02:42,182 - INFO - Scaled testing features shape: (3030, 15, 17)
2025-02-12 06:02:42,182 - INFO - Scaled training target shape: (14134,)
2025-02-12 06:02:42,183 - INFO - Scaled validation target shape: (3028,)
2025-02-12 06:02:42,183 - INFO - Scaled testing target shape: (3030,)
2025-02-12 06:02:42,183 - INFO - Starting LSTM hyperparameter optimization with Optuna using 54 parallel trials...
2025-02-12 07:37:13,510 - INFO - Best LSTM Hyperparameters: {'num_lstm_layers': 1, 'lstm_units': 128, 'dropout_rate': 0.19423178656609374, 'learning_rate': 0.00804108868847495, 'optimizer': 'Adam', 'decay': 5.071818942904124e-05}
2025-02-12 07:37:13,829 - INFO - Training best LSTM model with optimized hyperparameters...
2025-02-12 08:09:36,560 - INFO - Evaluating final LSTM model...
2025-02-12 08:09:38,220 - INFO - Test MSE: 0.0820
2025-02-12 08:09:38,220 - INFO - Test RMSE: 0.2863
2025-02-12 08:09:38,220 - INFO - Test MAE: 0.1813
2025-02-12 08:09:38,220 - INFO - Test R2 Score: 0.9932
2025-02-12 08:09:38,220 - INFO - Directional Accuracy: 0.4794
2025-02-12 08:09:39,097 - WARNING - You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`.
2025-02-12 08:09:39,171 - INFO - Saved best LSTM model and scaler objects (best_lstm_model.h5, scaler_features.pkl, scaler_target.pkl).
2025-02-12 08:09:39,171 - INFO - Training DQN agent: Attempt 1 with hyperparameters: {'lr': 0.001, 'gamma': 0.95, 'exploration_fraction': 0.1, 'buffer_size': 10000, 'batch_size': 64}
2025-02-12 09:41:33,971 - INFO - Agent achieved final net worth: $10000.00
2025-02-12 09:41:33,971 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-12 09:41:33,972 - INFO - Training DQN agent: Attempt 2 with hyperparameters: {'lr': 0.0009000000000000001, 'gamma': 0.95, 'exploration_fraction': 0.12000000000000001, 'buffer_size': 10000, 'batch_size': 64}
2025-02-12 11:15:38,178 - INFO - Agent achieved final net worth: $10000.00
2025-02-12 11:15:38,179 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-12 11:15:38,179 - INFO - Training DQN agent: Attempt 3 with hyperparameters: {'lr': 0.0008100000000000001, 'gamma': 0.95, 'exploration_fraction': 0.14, 'buffer_size': 10000, 'batch_size': 64}
2025-02-12 12:50:02,938 - INFO - Agent achieved final net worth: $10000.00
2025-02-12 12:50:02,938 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-12 12:50:02,938 - INFO - Training DQN agent: Attempt 4 with hyperparameters: {'lr': 0.000729, 'gamma': 0.95, 'exploration_fraction': 0.16, 'buffer_size': 10000, 'batch_size': 64}
2025-02-12 14:24:59,103 - INFO - Agent achieved final net worth: $10000.00
2025-02-12 14:24:59,103 - INFO - Performance below threshold. Adjusting hyperparameters and retrying...
2025-02-12 14:24:59,104 - INFO - Training DQN agent: Attempt 5 with hyperparameters: {'lr': 0.0006561000000000001, 'gamma': 0.95, 'exploration_fraction': 0.18, 'buffer_size': 10000, 'batch_size': 64}
2025-02-12 15:59:46,810 - INFO - Agent achieved final net worth: $11969.91
2025-02-12 15:59:46,810 - INFO - Agent meets performance criteria!
2025-02-12 15:59:46,818 - INFO - Final DQN agent trained and saved.
2025-02-12 15:59:46,818 - INFO - Running final inference with the trained DQN model...
2025-02-12 16:26:29,155 - INFO - Final inference completed. Results logged and displayed.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 90 KiB