wip
This commit is contained in:
@@ -392,9 +392,13 @@ class NegativeCaseTrainer:
|
||||
case.retraining_count += 1
|
||||
case.last_retrained = datetime.now()
|
||||
|
||||
# Calculate improvements (simulated)
|
||||
session.loss_improvement = np.random.uniform(0.1, 0.5) # 10-50% improvement
|
||||
session.accuracy_improvement = np.random.uniform(0.05, 0.2) # 5-20% improvement
|
||||
# Calculate improvements from actual training metrics (NO SYNTHETIC DATA)
|
||||
# If actual training metrics are not available, set to 0.0 instead of random values
|
||||
# TODO: Replace with actual model training that returns real loss/accuracy improvements
|
||||
session.loss_improvement = 0.0 # Set to 0 until real training metrics available
|
||||
session.accuracy_improvement = 0.0 # Set to 0 until real training metrics available
|
||||
|
||||
logger.warning(f"Training session completed but improvements not calculated - intensive training not yet implemented")
|
||||
|
||||
# Store training session results
|
||||
self._store_training_session(session)
|
||||
|
||||
@@ -2097,13 +2097,20 @@ class TradingOrchestrator:
|
||||
|
||||
# Choose best action - safe way to handle max with key function
|
||||
if action_scores:
|
||||
# Add small random component to break ties and prevent pure bias
|
||||
import random
|
||||
for action in action_scores:
|
||||
# Add tiny random noise (±0.001) to break exact ties
|
||||
action_scores[action] += random.uniform(-0.001, 0.001)
|
||||
# Break exact ties deterministically (NO RANDOM DATA)
|
||||
# Use action order as tie-breaker: BUY > SELL > HOLD
|
||||
action_order = {'BUY': 3, 'SELL': 2, 'HOLD': 1}
|
||||
|
||||
# Find max score
|
||||
max_score = max(action_scores.values())
|
||||
|
||||
# If multiple actions have same score, prefer BUY > SELL > HOLD
|
||||
tied_actions = [action for action, score in action_scores.items() if score == max_score]
|
||||
if len(tied_actions) > 1:
|
||||
best_action = max(tied_actions, key=lambda a: action_order.get(a, 0))
|
||||
else:
|
||||
best_action = tied_actions[0]
|
||||
|
||||
best_action = max(action_scores.keys(), key=lambda k: action_scores[k])
|
||||
best_confidence = action_scores[best_action]
|
||||
|
||||
# DEBUG: Log action scores to understand bias
|
||||
|
||||
Reference in New Issue
Block a user