mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-14 22:08:27 +00:00
Added the Model Comparison assistant for blind comparisons of two models (#1009)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
12f26445ba
commit
b7255694cd
221 files changed
+19989
-90
No files matched your search
@@ -0,0 +1,47 @@
|
||||
using AIStudio.Components;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Assistants.ModelComparison;
|
||||
|
||||
/// <summary>
|
||||
/// A ranking of the models: their wins, ties, and losses as a chart, and as a table with their share of wins and how
|
||||
/// sure that share is.
|
||||
/// </summary>
|
||||
public partial class ModelComparisonRanking : MSGComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the models, best first, by the votes of the user or by the verdicts of the judges.
|
||||
/// </summary>
|
||||
[Parameter, EditorRequired]
|
||||
public IReadOnlyList<ModelComparisonModelStanding> Standings { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The wins, ties, and losses of each model, as the three series of a stacked bar chart.
|
||||
/// </summary>
|
||||
private List<ChartSeries<double>> OutcomeSeries =>
|
||||
[
|
||||
new() { Name = T("Wins"), Data = new([.. this.Standings.Select(standing => (double)standing.Wins)]) },
|
||||
new() { Name = T("Ties"), Data = new([.. this.Standings.Select(standing => (double)standing.Ties)]) },
|
||||
new() { Name = T("Losses"), Data = new([.. this.Standings.Select(standing => (double)standing.Losses)]) },
|
||||
];
|
||||
|
||||
private StackedBarChartOptions ChartOptions => new()
|
||||
{
|
||||
ChartPalette = ModelComparisonCharts.OUTCOME_PALETTE,
|
||||
YAxisTicks = ModelComparisonCharts.AxisStep(this.Standings.Select(standing => (double)(standing.Wins + standing.Ties + standing.Losses))),
|
||||
YAxisToStringFunc = value => ((long)value).CompactCount(),
|
||||
XAxisLabelRotation = ModelComparisonCharts.LabelRotation(this.Standings.Count),
|
||||
};
|
||||
|
||||
private string FormatRange(ModelComparisonWinShare winShare) => winShare is { LowerBound: { } lower, UpperBound: { } upper }
|
||||
? string.Format(ModelComparisonFormat.Culture, T("{0} to {1}"), ModelComparisonFormat.Share(lower), ModelComparisonFormat.Share(upper))
|
||||
: "-";
|
||||
|
||||
private string SignificanceText(ModelComparisonSignificance significance) => significance switch
|
||||
{
|
||||
ModelComparisonSignificance.CLEARLY_BETTER => T("Clearly better"),
|
||||
ModelComparisonSignificance.CLEARLY_WORSE => T("Clearly worse"),
|
||||
_ => T("Not yet clear"),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user