Fix what a second independent reading of the Phase 8 fixes found
ci / test (postgres) (push) Failing after 6m9s
ci / test (sqlite) (push) Successful in 7m6s
ci / image (push) Skipped
ci / test (postgres) (pull_request) Successful in 5m51s
ci / test (sqlite) (pull_request) Successful in 7m3s
ci / image (pull_request) Successful in 1m51s

One funded signal was enough to start the model for good, because the interval
of a few cases had no width: it now takes a hundred, weighed among themselves.
A computer always off at 03:00 never made the night of the model: a job to make
up for counts from the first start that knows it, and the night waits for the
bars of the absence. Stories are seen as they were when the decision was due, a
report already out does not close a label, an undone promotion starts the trial
again, and the trade card finds the estimate of an example born earlier.

ADR 0018 point 18 has the list; each defect has its test.

refs #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 14:27:03 +01:00
1 parent 0b0f4a5e75
commit c7e462b6f4
18 files changed
+371 -26

No files matched your search

+13 -6
View File
@@ -230,7 +230,7 @@ internal sealed record LearningView
Missing = state.ActivatedAt is null && activation.Enough ? Missings(activation) : [],
LastTraining = last is null ? "mai" : $"{LongDay(DayOf(last.TrainedAt), now)}, versione {last.Version}",
Bands = bands,
BandsText = bands.Count == 0 ? "Nessuna stima ha ancora un esito." : BandsWords(bands),
BandsText = bands.Count == 0 ? "Nessuna stima ha ancora un esito." : BandsWords(bands, history ? null : activation.CalibrationError),
BandsFromHistory = history && bands.Count > 0,
Champion = Column(champion, now),
Challenger = Column(challenger, now),
@@ -341,7 +341,11 @@ internal sealed record LearningView
: $"Nessuna fascia di probabilità ha ancora {Judge.BandMin} casi.");
}
if (!check.Improves)
if (check.Funded < ActivationCheck.FundedNeeded)
{
missing.Add($"Servono almeno {ActivationCheck.FundedNeeded} segnali di strategie con un capitale, anche in simulazione: per ora {(check.Funded == 1 ? "è uno" : $"sono {Format.Number(check.Funded)}")}.");
}
else if (!check.Improves)
{
missing.Add("Non è ancora provato che, filtrando lui, si guadagni di più per operazione proposta: la differenza può essere caso.");
}
@@ -353,8 +357,11 @@ internal sealed record LearningView
private static LearningBand Band(CalibrationBand b) => new((int)Math.Round(b.From * 100), (int)Math.Round(b.To * 100), b.Cases, Round(b.Estimated * 100, 1), Round(b.Observed * 100, 1));
/// <summary>The sentence under the chart: the highest band that counts, whether it is well calibrated, the bands that do not count.</summary>
public static string BandsWords(IReadOnlyList<LearningBand> bands)
/// <summary>
/// The sentence under the chart: the highest band that counts, whether it is well calibrated, the bands that do not
/// count. <paramref name="measured"/> is the error of the criterion to start counting (11.5), when it is the judge.
/// </summary>
public static string BandsWords(IReadOnlyList<LearningBand> bands, double? measured = null)
{
ArgumentNullException.ThrowIfNull(bands);
var solid = bands.Where(b => b.Solid).ToList();
@@ -363,10 +370,10 @@ internal sealed record LearningView
return $"Nessuna fascia ha ancora {Judge.BandMin} casi: troppo pochi per contarci.";
}
var error = solid.Sum(b => b.Cases * Math.Abs(b.Estimated - b.Observed)) / solid.Sum(b => b.Cases);
var error = measured is { } known ? Round(known * 100, 1) : solid.Sum(b => b.Cases * Math.Abs(b.Estimated - b.Observed)) / solid.Sum(b => b.Cases);
var best = solid[^1];
var text = $"Quando stima tra il {best.From} e il {best.To}%, è andata bene il {Format.Number(best.Observed)}% delle volte: " +
(error < (decimal)ActivationCheck.MaxCalibrationError * 100 ? "è ben tarato." : $"non è ancora ben tarato, in media sbaglia di {Format.Number(error, 1)} punti.");
((measured is { } exact ? exact < ActivationCheck.MaxCalibrationError : error < (decimal)ActivationCheck.MaxCalibrationError * 100) ? "è ben tarato." : $"non è ancora ben tarato, in media sbaglia di {Format.Number(error, 1)} punti.");
var above = bands.Where(b => !b.Solid && b.From >= best.To).ToList();
var below = bands.Where(b => !b.Solid && b.To <= solid[0].From).ToList();
var between = bands.Where(b => !b.Solid).Except(above).Except(below).Sum(b => b.Cases);