training on predictins - WIP?
This commit is contained in:
@@ -2800,20 +2800,34 @@ class ChartManager {
|
||||
predicted: prediction.candle, // [O, H, L, C, V]
|
||||
actual: prediction.accuracy.actualCandle, // [O, H, L, C, V]
|
||||
errors: prediction.accuracy.errors, // {open, high, low, close, volume}
|
||||
pctErrors: prediction.accuracy.pctErrors, // {open, high, low, close, volume}
|
||||
directionCorrect: prediction.accuracy.directionCorrect,
|
||||
direction_correct: prediction.accuracy.directionCorrect,
|
||||
accuracy: prediction.accuracy.accuracy
|
||||
};
|
||||
|
||||
console.log('[Prediction Metrics for Training]', metrics);
|
||||
console.log('[Prediction Metrics] Triggering online learning:', metrics);
|
||||
|
||||
// Send to backend via WebSocket for incremental training
|
||||
if (window.socket && window.socket.connected) {
|
||||
window.socket.emit('prediction_accuracy', metrics);
|
||||
console.log(`[${timeframe}] Sent prediction accuracy to backend for training`);
|
||||
} else {
|
||||
console.warn('[Training] WebSocket not connected - metrics not sent to backend');
|
||||
}
|
||||
// Send to backend for incremental training (online learning)
|
||||
fetch('/api/train-validated-prediction', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(metrics)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log(`[${timeframe}] ✓ Online learning triggered - model updated from validated prediction`);
|
||||
|
||||
// Update metrics display if available
|
||||
if (window.updateMetricsDisplay) {
|
||||
window.updateMetricsDisplay(data.metrics);
|
||||
}
|
||||
} else {
|
||||
console.warn(`[${timeframe}] Training failed:`, data.error);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn('[Training] Error sending metrics:', error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user