ci / test (postgres) (push) Successful in 6m37s
ci / test (sqlite) (push) Successful in 7m51s
ci / test (postgres) (pull_request) Successful in 5m40s
ci / test (sqlite) (pull_request) Successful in 7m31s
ci / image (push) Successful in 2m29s
ci / image (pull_request) Successful in 59s
Two reviewers with a clean context read the engine and the screens. The isotonic calibration took its floor from the first step, even of two cases, so with few winners it flattened every estimate: the first model is rebuilt with the fix. Learning failures no longer forget the multiplier an operation was born with, nor stop a decision or the nightly check; recovered decisions read the outside world as it was when due; models estimate only the strategies they studied; a newer history does not repeat what was lived. The screens count examples instead of verifications, show the next threshold and never round an alarm to 50%; two forms now check the antiforgery token. Each defect has its test, on both engines. ADR 0018 point 17 has the list. refs #67 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
89 lines
4.9 KiB
Plaintext
89 lines
4.9 KiB
Plaintext
@* How often it went well against what the model said (SPEC 13.4, mockup 06): one scale, 2 px lines, faint grid, the
|
|
perfect estimate beside it, direct labels on the fullest band and on the last one, a box on hover and the table.
|
|
As in EquityChart the lines are SVG stretched to the box; texts and points are HTML placed in percent. *@
|
|
@if (Bands.Count > 0)
|
|
{
|
|
var loX = Bands.Min(b => b.From) / 10 * 10;
|
|
var hiX = (Bands.Max(b => b.To) + 9) / 10 * 10;
|
|
var loY = Math.Min(loX, (int)Math.Floor(Bands.Min(b => b.Observed)) / 10 * 10) - 5m;
|
|
var hiY = Math.Max(hiX, Bands.Max(b => b.Observed)) + 4m;
|
|
var step = hiX - loX > 60 ? 20 : 10;
|
|
var fullest = Bands.MaxBy(b => b.Cases)!;
|
|
var last = Bands[^1];
|
|
decimal X(decimal v) => (v - loX) / (hiX - loX) * 1000m;
|
|
decimal Y(decimal v) => (hiY - v) / (hiY - loY) * 1000m;
|
|
<figure class="chart calibration" aria-label="Quanto spesso è andata bene, rispetto a quello che diceva il modello">
|
|
<p class="calibration-title" aria-hidden="true">…va bene davvero</p>
|
|
<div class="calibration-box">
|
|
<div class="chart-axis" aria-hidden="true">
|
|
@for (var t = (int)Math.Ceiling(loY / step) * step; t <= hiY; t += step)
|
|
{
|
|
<span style="top:@Pct(Y(t) / 10)">@t%</span>
|
|
}
|
|
</div>
|
|
<div class="chart-plot">
|
|
<svg viewBox="0 0 1000 1000" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
|
@for (var t = (int)Math.Ceiling(loY / step) * step; t <= hiY; t += step)
|
|
{
|
|
<line class="grid" x1="0" x2="1000" y1="@Css(Y(t))" y2="@Css(Y(t))" vector-effect="non-scaling-stroke" />
|
|
}
|
|
<line class="base" x1="0" x2="1000" y1="1000" y2="1000" vector-effect="non-scaling-stroke" />
|
|
<line class="bench" x1="0" y1="@Css(Y(loX))" x2="1000" y2="@Css(Y(hiX))" vector-effect="non-scaling-stroke" />
|
|
<polyline class="equity" points="@string.Join(" ", Bands.Select(b => Css(X(b.Estimated)) + "," + Css(Y(b.Observed))))" vector-effect="non-scaling-stroke" />
|
|
</svg>
|
|
@foreach (var b in Bands)
|
|
{
|
|
<span class="end-dot hover-dot" style="left:@Pct(X(b.Estimated) / 10);top:@Pct(Y(b.Observed) / 10)"><span class="hover-box">Tra @(b.From)% e @(b.To)%<br />@Format.Number(b.Observed)% su @Cases(b)</span></span>
|
|
}
|
|
<span class="point-label @(X(fullest.Estimated) > 450m ? "below-left" : "below")" style="left:@Pct(X(fullest.Estimated) / 10);top:@Pct(Y(fullest.Observed) / 10)">@Label(fullest)</span>
|
|
@if (last != fullest)
|
|
{
|
|
<span class="point-label above" style="left:@Pct(X(last.Estimated) / 10);top:@Pct(Y(last.Observed) / 10)">@Label(last)</span>
|
|
}
|
|
</div>
|
|
</div>
|
|
<div class="calibration-x" aria-hidden="true">
|
|
@for (var t = loX; t <= hiX; t += step)
|
|
{
|
|
<span style="left:@Pct(X(t) / 10)">@t%</span>
|
|
}
|
|
</div>
|
|
<p class="calibration-foot" aria-hidden="true">Quando il modello dice…</p>
|
|
<figcaption class="legend">
|
|
<span class="key key-equity">Il modello</span>
|
|
<span class="key key-bench">Stima perfetta</span>
|
|
</figcaption>
|
|
<p class="calibration-text">@Text</p>
|
|
<details class="chart-table">
|
|
<summary>Vedi i numeri in una tabella</summary>
|
|
<div class="table-wrap">
|
|
<table class="table">
|
|
<thead><tr><th scope="col">Quando il modello dice</th><th scope="col" class="num">Casi</th><th scope="col" class="num">È andata bene</th><th scope="col">Affidabilità</th></tr></thead>
|
|
<tbody>
|
|
@foreach (var b in Bands)
|
|
{
|
|
<tr><td>tra @(b.From)% e @(b.To)%</td><td class="num">@Format.Number(b.Cases)</td><td class="num">@Format.Number(b.Observed)%</td><td class="@(b.Solid ? null : "attention-text")">@(b.Solid ? "conta" : "troppo pochi casi per contarci")</td></tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</details>
|
|
</figure>
|
|
}
|
|
|
|
@code {
|
|
[Parameter, EditorRequired]
|
|
public IReadOnlyList<LearningBand> Bands { get; set; } = [];
|
|
|
|
[Parameter]
|
|
public string Text { get; set; } = "";
|
|
|
|
private static string Label(LearningBand b) => $"{Format.Number(b.Observed)}% su {Cases(b)}";
|
|
|
|
private static string Cases(LearningBand b) => b.Cases == 1 ? "un caso" : Format.Number(b.Cases) + " casi";
|
|
|
|
private static string Css(decimal v) => v.ToString("0.##", CultureInfo.InvariantCulture);
|
|
|
|
private static string Pct(decimal v) => v.ToString("0.###", CultureInfo.InvariantCulture) + "%";
|
|
}
|