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

+19
View File
@@ -67,6 +67,17 @@ public sealed class LearningScreenTests
{ DecisionId = earlier }, _none);
}, _none);
HasAll(await server.TextAsync("/operazioni"), "Il modello stimava il 61% di probabilità di guadagno (di solito 48%)");
// Born the evening before, with the simulated operation closed on the day of the purchase: still the one bought.
var opened = (await db.ReadAsync(s => s.FirstOrDefaultAsync("SELECT t.opened_at FROM trades t JOIN instruments i ON i.id = t.instrument_id WHERE i.symbol = 'MSFT' AND t.status = 'closed' ORDER BY t.opened_at DESC LIMIT 1", r => (DateTimeOffset?)r.Moment("opened_at")), _none))!.Value;
await db.WriteAsync(async s =>
{
await s.ExecuteAsync("UPDATE decisions SET created_at = @at WHERE decision_id = @d", _none, ("at", opened.AddHours(-10)), ("d", earlier));
var example = (await s.FirstOrDefaultAsync("SELECT id FROM ml_features WHERE decision_id = @d", r => (Guid?)r.Id("id"), ("d", earlier)))!.Value;
var day = DateOnly.FromDateTime(opened.UtcDateTime);
await LearningStore.AddLabelAsync(s, clock, example, new CaseLabel(false, -0.01, day.AddDays(-2), day, "x"), _none);
}, _none);
HasAll(await server.TextAsync("/operazioni"), "Il modello stimava il 61% di probabilità di guadagno (di solito 48%)");
using var post = await server.PostFormAsync("/apprendimento", "/azioni/modello/annulla-promozione");
Assert.AreEqual("/apprendimento?errore=motore", ServerHarness.Location(post));
using var settings = await server.PostFormAsync("/impostazioni", "/azioni/modello", (LearningSettings.Aside.Key, "on"));
@@ -316,6 +327,10 @@ public sealed class LearningScreenTests
StringAssert.EndsWith(Line(",\"counts\":false,\"aside\":true"), ": era messo da parte, non ha cambiato la dimensione");
StringAssert.EndsWith(Line(",\"counts\":false,\"aside\":false"), ": solo osservazione, non ha cambiato la dimensione");
StringAssert.EndsWith(Line(",\"counts\":true,\"aside\":false"), ": taglia piena");
string Reduced(string applied) => ReasonTexts.Model("{\"probability\":0.61,\"base_rate\":0.48,\"applied\":" + applied + "}")!;
StringAssert.EndsWith(Reduced("0.996"), ": acquisto ridotto al 99%");
StringAssert.EndsWith(Reduced("0.004"), ": acquisto ridotto al 1%");
StringAssert.EndsWith(Reduced("0"), ": acquisto non fatto");
}
/// <summary>Bands under 20 cases are said unreliable, in the sentence and one by one.</summary>
@@ -332,6 +347,10 @@ public sealed class LearningScreenTests
LearningView.BandsWords([B(30, 1, 0), B(45, 30, 20)]));
StringAssert.EndsWith(LearningView.BandsWords([B(30, 30, 30), B(35, 3, 30), B(45, 30, 47)]), "Nelle fasce di mezzo con meno di 20 casi ha visto solo 3 casi, troppo pochi per contarci.");
Assert.AreEqual("Nessuna fascia ha ancora 20 casi: troppo pochi per contarci.", LearningView.BandsWords([B(30, 19, 30)]));
// The judge is the error of the criterion to start counting, as the rest of the page says it.
StringAssert.EndsWith(LearningView.BandsWords([B(45, 30, 20)], 0.01), "è andata bene il 20% delle volte: è ben tarato.");
StringAssert.EndsWith(LearningView.BandsWords([B(45, 30, 47)], 0.06), "non è ancora ben tarato, in media sbaglia di 6,0 punti.");
}
/// <summary>The clues after the ninth are "Tutto il resto", the whole stays 100; the sentence about the news follows the numbers.</summary>