aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-predictor.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/module-predictor.js')
-rw-r--r--modules/core/module-predictor.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/core/module-predictor.js b/modules/core/module-predictor.js
index aebda87..b534d34 100644
--- a/modules/core/module-predictor.js
+++ b/modules/core/module-predictor.js
@@ -118,6 +118,7 @@ class PredictorModule {
return this._dataPoints.filter(dp => {
if (!dp.observedDuration) return false; // outcomes only, never predictions
if (dp.usable === false) return false; // aborted runs are not evidence
+ if (!(dp.observedDuration >= 1.5)) return false; // belt and braces: never evidence
if (dp.features) return this._similarity(features, dp.features) > 0.3;
return false;
});
@@ -269,7 +270,7 @@ class PredictorModule {
// ─── Commands ───
showStatus() {
- const actualExecutions = this._dataPoints.filter(dp => dp.observedDuration).length;
+ const actualExecutions = this._dataPoints.filter(dp => dp.observedDuration && dp.usable !== false).length;
const paired = this._accuracy.total;
const unpaired = this._dataPoints.filter(dp => dp.paired === false).length;
const accPct = paired > 0 ? ((this._accuracy.correct / paired) * 100).toFixed(0) + '%' : 'n/a';
@@ -374,8 +375,16 @@ class PredictorModule {
const data = fs.fsReadJSON('/system/metrics/predictor.json');
if (!data) return;
- // Prediction-only points are noise for similarity; keep outcomes.
- this._dataPoints = (data.dataPoints || []).filter(dp => dp && dp.observedDuration);
+ // Legacy (pre-v2) points carry no `usable`. Backfill it from the measurement — an
+ // aborted run must not enter similarity as evidence (measured: a 0.079 s point
+ // dragged avgDuration to ~0 and floored every prediction at 1 s).
+ this._dataPoints = (data.dataPoints || [])
+ .filter(dp => dp && dp.observedDuration)
+ .map(dp => {
+ if (typeof dp.usable !== 'boolean') dp.usable = dp.observedDuration >= 1.5;
+ return dp;
+ })
+ .filter(dp => dp.usable !== false);
this._predictions = data.predictions || 0;
if (data.v === this._SCHEMA) {