@inherits LoadedComponent
@page "/apprendimento"
@inject AnubisHost Host
@inject ShellData Shell
@using Anubis.Learning
Apprendimento · Anubis
@{
var v = _view;
var s = v.Summary;
var c = _currency;
}
Il modello impara dall'esito di ogni segnale.
@if (Ok == "promozione")
{
Promozione annullata: è tornata in carica la versione precedente.
}
else if (Errore is not null)
{
@(Errore == "motore" ? "Nella modalità dimostrativa non si cambia nulla." : "Non c'è nessuna promozione da annullare.")
}
@Badge(s.State)
@v.Title
@v.Text
@if (s.State != LearningStates.None)
{
@if (s.Signals < s.Needed)
{
Segnali già valutati@s.Signals su @s.Needed necessari
}
else
{
Segnali già valutati@Format.Number(s.Signals) (ne servivano @s.Needed)
}
@if (v.Pace is { } pace)
{
@pace
}
}
@if (v.Missing.Count > 0)
{
@foreach (var m in v.Missing)
{
- @m
}
}
@if (s.State == LearningStates.Manual)
{
Vai a Impostazioni
}
- Previsioni azzeccate su casi mai visti
- @(s.Precision is { } precision ? precision + "%" : "—")
- @(s.Precision is null ? "Si misura al primo addestramento" : "Tirando a caso sarebbe il 50%")
- Ultimo addestramento
- @Capital(v.LastTraining)
- @s.NextLabel
- @Capital(s.NextCheck)
Ci si può fidare delle sue probabilità?
@if (v.Bands.Count == 0)
{
@v.BandsText Qui vedrai quante volte va bene davvero quando il modello dice che una cosa è probabile.
}
else
{
Più i punti stanno sulla linea, più la stima corrisponde ai fatti.@(v.BandsFromHistory ? " Per ora sono i casi storici che non aveva studiato: quelli dal vivo sono ancora troppo pochi." : "")
}
Cosa guarda di più
@if (v.Champion is null)
{
Si vedrà con il primo modello.
}
else
{
Quanto pesa ogni informazione nelle sue stime, su 100.
@if (v.Weights.Count > 0)
{
var most = v.Weights.Max(w => w.Share);
@foreach (var w in v.Weights)
{
- @w.Name@w.Share
}
}
@v.WeightsText
}
Il modello in carica e lo sfidante
Lo sfidante gira in ombra accanto al modello in carica. Ne prende il posto solo se è chiaramente migliore.
@if (v.Champion is { } now)
{
var other = v.Challenger;
var same = other is null || other.GainWithout == now.GainWithout;
| In carica, versione @now.Version | @if (other is not null){Sfidante, versione @other.Version | }
| Addestrato | @now.Trained | @if (other is not null){@other.Trained | }
| Casi studiati | @Format.Number(now.Examples) | @if (other is not null){@Format.Number(other.Examples) | }
| Previsioni azzeccate su casi mai visti | @Share(now.Precision) | @if (other is not null){@Share(other.Precision) | }
| Errore sulle probabilità (più basso è meglio) | @Error(now.Error) | @if (other is not null){@Error(other.Error) | }
| Guadagno medio per operazione se filtrasse lui @if (same && now.GainWithout is { } without){(senza filtro: @Shell.Money(without, c, withSign: true))} |
@Gain(now, same, c) | @if (other is not null){@Gain(other, same, c) | }
@if (other is not null)
{
| Casi di confronto diretto | non serve | @Format.Number(v.Pairs) su @v.PairsNeeded |
}
}
@if (v.GainOnReference)
{
Nessuna strategia con capitale affidato ha ancora casi: il guadagno è calcolato su tutte, con il capitale di riferimento.
}
@v.TrialTitle @v.TrialText
@if (v.Choice is { } choice)
{
Come è stato scelto il modello in carica
@choice Sono tutte prove su casi che il modello non aveva studiato; contano anche quelle scartate.
| Tipo di modello | Previsioni azzeccate | Errore | Guadagno per operazione | Esito |
@foreach (var a in v.Attempts)
{
| @a.Learner | @Share(a.Precision) | @Error(a.Error) | @Shell.Money(a.Gain, c, withSign: true) | @(a.Chosen ? "scelto" : "non scelto") |
}
}
@if (v.UndoTo is { } back && !Shell.IsDemo)
{
}
Sorveglianza
@if (v.Checked)
{
@(v.Anomaly ? "Anomalia" : "Nessuna anomalia")
}
@if (!v.Checked)
{
Il controllo gira ogni notte alle 03:00: confronta le stime con gli esiti e il mercato di oggi con quello su cui ha studiato.
}
else
{
@foreach (var check in v.Checks)
{
- "tick", "warn" => "alert", _ => "clock" })" Size="16" />@check.Text
}
}
Se la precisione cala, il modello viene messo da parte da solo e le strategie proseguono senza di lui.
Cosa ha imparato finora
@if (v.Found.Count == 0)
{
Ancora niente: le relazioni tra indizi ed esiti si cercano ogni notte, quando i casi bastano per un confronto.
}
else
{
@foreach (var d in v.Found)
{
-
@d.Title
@d.Detail
@if (d.Cases < 20){}@(d.Cases == 1 ? "Un caso" : Format.Number(d.Cases) + " casi"): @d.Trust
}
}
@if (v.News.Count > 0)
{
Cosa succede ai prezzi dopo una notizia
Rendimento medio dalla prima chiusura dopo la notizia. È solo un'informazione: non cambia nessuna regola.
| Tipo di notizia | Dopo 1 giorno | Dopo 5 giorni | Casi |
@foreach (var n in v.News)
{
| @NewsEventNames.Label(n.Kind) | @Move(n.OneDay) | @Move(n.FiveDays) | @n.Cases: @n.Trust |
}
}
Storia
@if (v.Story.Count == 0)
{
La storia comincia con il primo modello.
}
else
{
@foreach (var e in v.Story.Take(LearningView.StoryRows))
{
- @e.When
- @e.Text
}
@if (v.Story.Count > LearningView.StoryRows)
{
Mostra i @(v.Story.Count - LearningView.StoryRows) eventi precedenti
@foreach (var e in v.Story.Skip(LearningView.StoryRows))
{
- @e.When
- @e.Text
}
}
}
@code {
private LearningView _view = null!;
private string _currency = "EUR";
[CascadingParameter]
public HttpContext? HttpContext { get; set; }
[SupplyParameterFromQuery(Name = "ok")]
public string? Ok { get; set; }
[SupplyParameterFromQuery(Name = "errore")]
public string? Errore { get; set; }
protected override async Task LoadAsync()
{
var ct = HttpContext?.RequestAborted ?? CancellationToken.None;
_currency = Shell.Effective((await Host.Services!.Settings.GetAsync(SettingsStore.Currency.Key, ct)).Value);
_view = await LearningView.LoadAsync(Host, Shell, ct);
}
private string Gain(LearningVersion version, bool same, string currency) => version.Gain is not { } gain ? "—"
: Shell.Money(gain, currency, withSign: true) + (same || version.GainWithout is not { } without ? "" : $" (senza: {Shell.Money(without, currency, withSign: true)})");
private static string Badge(string state) => state switch
{
LearningStates.None => "Non ancora partito",
LearningStates.Active => "Attivo",
LearningStates.Aside => "Messo da parte",
LearningStates.Manual => "Messo da parte da te",
_ => "In osservazione",
};
private static string BadgeIcon(string state) => state switch
{
LearningStates.None => "clock",
LearningStates.Active => "check",
LearningStates.Aside => "alert",
LearningStates.Manual => "pause",
_ => "eye",
};
private static string Share(int? points) => points is { } p ? p + "%" : "—";
private static string Error(decimal? value) => value is { } e ? Format.Number(e, 3) : "—";
private static string Move(double value) => Format.Percent((decimal)Math.Round(value * 100, 2), 2, withSign: true);
private static string Capital(string text) => text.Length == 0 ? text : char.ToUpper(text[0], CultureInfo.GetCultureInfo("it-IT")) + text[1..];
private static string Css(decimal v) => v.ToString("0.##", CultureInfo.InvariantCulture);
}