Show what the model knows on its own screen and let the user set it aside
The Apprendimento screen says in plain words whether the model counts, how well its probabilities hold, which clues it weighs, how the challenger is doing and what it has learned. Thresholds, set-aside and the undo of a promotion live in Impostazioni; anything that shrinks less with real money asks for the phrase. The new tests also caught a wrong column name that broke the Panoramica as soon as the first model existed. refs #66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
14e8a872dc
commit
f69943f70a
22 files changed
+1680
-27
No files matched your search
@@ -0,0 +1,86 @@
|
||||
@* 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 @b.Cases casi</span></span>
|
||||
}
|
||||
<span class="point-label 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">@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 {(b.Cases == 1 ? "un caso" : 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) + "%";
|
||||
}
|
||||
Reference in new issue
Block a user