Let the model shrink entries once it has earned it and watch it every night

The multiplier is the last corrective and is fixed when an operation is
born. Until the criteria of SPEC 11.5 are met the estimates are only noted
beside each operation. Every night the outcomes are labelled and the model
is checked (precision, ADWIN on the error, clues never studied) and set
aside when it is wrong; every Sunday a challenger is trained or judged.

refs #64

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 12:02:55 +01:00
1 parent 99ff2d9402
commit df21962da3
16 files changed
+1615 -52

No files matched your search

+36
View File
@@ -41,12 +41,48 @@ internal static class ReasonTexts
yield break;
}
if (stage == DecisionStages.Model)
{
if (Model(data) is { } line)
{
yield return new WhyLine(line, good);
}
yield break;
}
foreach (var reason in reasons)
{
yield return new WhyLine(Text(reason).TrimEnd('.') + (stage == DecisionStages.Risk ? Asked(data) : ""), good || stage == DecisionStages.Strategy);
}
}
/// <summary>What the model said of an entry (SPEC 11.5): its estimate, the usual share of gains, what it changed.</summary>
internal static string? Model(string? data)
{
if (data is null)
{
return null;
}
using var json = JsonDocument.Parse(data);
double? Number(string name) => json.RootElement.TryGetProperty(name, out var value) && value.ValueKind == JsonValueKind.Number ? value.GetDouble() : null;
if (Number("probability") is not { } probability || Number("base_rate") is not { } rate)
{
return null;
}
var it = CultureInfo.GetCultureInfo("it-IT");
var said = string.Create(it, $"Il modello stimava il {probability * 100:0}% di probabilità di guadagno (di solito {rate * 100:0}%)");
var applied = Number("applied") ?? 1;
if (applied < 1)
{
return applied > 0 ? string.Create(it, $"{said}: acquisto ridotto al {applied * 100:0}%") : said + ": acquisto non fatto";
}
return json.RootElement.TryGetProperty("counts", out var counts) && counts.ValueKind == JsonValueKind.True ? said + ": taglia piena" : said + ": in osservazione, non cambia niente";
}
// "(chiesti 0,05, passati 0,03)" when the stage shrank the order.
private static string Asked(string? data)
{