35 instantiations of NumericMetric
Microsoft.Extensions.AI.Evaluation.Integration.Tests (20)
ResultsTests.cs (20)
343
var metricA = new
NumericMetric
("Metric with value 0", 0, reason: "Because of reason A");
344
var metricB = new
NumericMetric
("Metric with value 1", 1, reason: "Because of reason B");
345
var metricC = new
NumericMetric
("Metric with value 2", 2, reason: "Because of reason C");
346
var metricD = new
NumericMetric
("Metric with value 3", 3, reason: "Because of reason D");
347
var metricE = new
NumericMetric
("Metric with value 4", 4, reason: "Because of reason E");
348
var metricF = new
NumericMetric
("Metric with value 5", 5, reason: "Because of reason F");
349
var metricG = new
NumericMetric
("Metric with value 6", 6, reason: "Because of reason G");
350
var metricH = new
NumericMetric
("Metric with no value", reason: "Because of reason H");
379
var metricA = new
NumericMetric
("Metric with value 0", 0, reason: "Because of reason A");
380
var metricB = new
NumericMetric
("Metric with value 1", 1, reason: "Because of reason B");
381
var metricC = new
NumericMetric
("Metric with value 2", 2, reason: "Because of reason C");
382
var metricD = new
NumericMetric
("Metric with value 3", 3, reason: "Because of reason D");
383
var metricE = new
NumericMetric
("Metric with value 4", 4, reason: "Because of reason E");
384
var metricF = new
NumericMetric
("Metric with value 5", 5, reason: "Because of reason F");
385
var metricG = new
NumericMetric
("Metric with value 6", 6, reason: "Because of reason G");
386
var metricH = new
NumericMetric
("Metric with no value", reason: "Because of reason H");
447
var metric5 = new
NumericMetric
("Metric with informational diagnostics only");
500
var metric5 = new
NumericMetric
("Metric with informational diagnostics only");
548
var metric3 = new
NumericMetric
("Metric with error diagnostics only", value: 5);
559
var metric5 = new
NumericMetric
("Metric with informational diagnostics only", value: 4);
Microsoft.Extensions.AI.Evaluation.Quality (10)
CoherenceEvaluator.cs (1)
77
var metric = new
NumericMetric
(CoherenceMetricName);
CompletenessEvaluator.cs (1)
74
var metric = new
NumericMetric
(CompletenessMetricName);
EquivalenceEvaluator.cs (1)
73
var metric = new
NumericMetric
(EquivalenceMetricName);
FluencyEvaluator.cs (1)
71
var metric = new
NumericMetric
(FluencyMetricName);
GroundednessEvaluator.cs (1)
72
var metric = new
NumericMetric
(GroundednessMetricName);
RelevanceEvaluator.cs (1)
75
var metric = new
NumericMetric
(RelevanceMetricName);
RelevanceTruthAndCompletenessEvaluator.cs (3)
88
var relevance = new
NumericMetric
(RelevanceMetricName);
89
var truth = new
NumericMetric
(TruthMetricName);
90
var completeness = new
NumericMetric
(CompletenessMetricName);
RetrievalEvaluator.cs (1)
80
var metric = new
NumericMetric
(RetrievalMetricName);
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (3)
ResultStoreTester.cs (1)
24
NumericMetric numericMetric = new
NumericMetric
("numeric", value: 3);
ScenarioRunResultTests.cs (2)
45
var numericMetric = new
NumericMetric
("numeric", value: 3)
136
var numericMetric = new
NumericMetric
("numeric", value: 3)
Microsoft.Extensions.AI.Evaluation.Safety (2)
ContentSafetyService.cs (2)
84
metric = new
NumericMetric
(metricName, doubleValue, reason);
97
metric = new
NumericMetric
(metricName, doubleValue, reason);
125 references to NumericMetric
Microsoft.Extensions.AI.Evaluation (7)
EvaluationMetric.cs (1)
22
[JsonDerivedType(typeof(
NumericMetric
), "numeric")]
NumericMetric.cs (6)
11
/// <see cref="
NumericMetric
"/> can be used to represent any numeric value. The underlying type of a
12
/// <see cref="
NumericMetric
"/>'s value is <see langword="double"/>. However, it can be used to represent any type of
16
/// A common use case for <see cref="
NumericMetric
"/> is to represent numeric scores that fall within a well defined
21
/// <param name="name">The name of the <see cref="
NumericMetric
"/>.</param>
22
/// <param name="value">The value of the <see cref="
NumericMetric
"/>.</param>
25
/// <see cref="
NumericMetric
"/>.
Microsoft.Extensions.AI.Evaluation.Integration.Tests (61)
QualityEvaluatorTests.cs (20)
105
Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.RelevanceMetricName, out
NumericMetric
? _));
106
Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.TruthMetricName, out
NumericMetric
? _));
107
Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.CompletenessMetricName, out
NumericMetric
? _));
108
Assert.True(result.TryGet(CoherenceEvaluator.CoherenceMetricName, out
NumericMetric
? _));
109
Assert.True(result.TryGet(FluencyEvaluator.FluencyMetricName, out
NumericMetric
? _));
110
Assert.True(result.TryGet(RelevanceEvaluator.RelevanceMetricName, out
NumericMetric
? _));
144
Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.RelevanceMetricName, out
NumericMetric
? _));
145
Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.TruthMetricName, out
NumericMetric
? _));
146
Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.CompletenessMetricName, out
NumericMetric
? _));
147
Assert.True(result.TryGet(CoherenceEvaluator.CoherenceMetricName, out
NumericMetric
? _));
148
Assert.True(result.TryGet(FluencyEvaluator.FluencyMetricName, out
NumericMetric
? _));
149
Assert.True(result.TryGet(RelevanceEvaluator.RelevanceMetricName, out
NumericMetric
? _));
181
Assert.True(result.TryGet(GroundednessEvaluator.GroundednessMetricName, out
NumericMetric
? groundedness));
182
Assert.True(result.TryGet(EquivalenceEvaluator.EquivalenceMetricName, out
NumericMetric
? equivalence));
183
Assert.True(result.TryGet(CompletenessEvaluator.CompletenessMetricName, out
NumericMetric
? completeness));
184
Assert.True(result.TryGet(RetrievalEvaluator.RetrievalMetricName, out
NumericMetric
? retrieval));
255
Assert.True(result.TryGet(GroundednessEvaluator.GroundednessMetricName, out
NumericMetric
? groundedness));
256
Assert.True(result.TryGet(EquivalenceEvaluator.EquivalenceMetricName, out
NumericMetric
? equivalence));
257
Assert.True(result.TryGet(CompletenessEvaluator.CompletenessMetricName, out
NumericMetric
? completeness));
258
Assert.True(result.TryGet(RetrievalEvaluator.RetrievalMetricName, out
NumericMetric
? retrieval));
ResultsTests.cs (22)
73
case
NumericMetric
numericMetric:
109
(m is
NumericMetric
s && s.Value is not null) ||
343
var
metricA = new NumericMetric("Metric with value 0", 0, reason: "Because of reason A");
344
var
metricB = new NumericMetric("Metric with value 1", 1, reason: "Because of reason B");
345
var
metricC = new NumericMetric("Metric with value 2", 2, reason: "Because of reason C");
346
var
metricD = new NumericMetric("Metric with value 3", 3, reason: "Because of reason D");
347
var
metricE = new NumericMetric("Metric with value 4", 4, reason: "Because of reason E");
348
var
metricF = new NumericMetric("Metric with value 5", 5, reason: "Because of reason F");
349
var
metricG = new NumericMetric("Metric with value 6", 6, reason: "Because of reason G");
350
var
metricH = new NumericMetric("Metric with no value", reason: "Because of reason H");
379
var
metricA = new NumericMetric("Metric with value 0", 0, reason: "Because of reason A");
380
var
metricB = new NumericMetric("Metric with value 1", 1, reason: "Because of reason B");
381
var
metricC = new NumericMetric("Metric with value 2", 2, reason: "Because of reason C");
382
var
metricD = new NumericMetric("Metric with value 3", 3, reason: "Because of reason D");
383
var
metricE = new NumericMetric("Metric with value 4", 4, reason: "Because of reason E");
384
var
metricF = new NumericMetric("Metric with value 5", 5, reason: "Because of reason F");
385
var
metricG = new NumericMetric("Metric with value 6", 6, reason: "Because of reason G");
386
var
metricH = new NumericMetric("Metric with no value", reason: "Because of reason H");
447
var
metric5 = new NumericMetric("Metric with informational diagnostics only");
500
var
metric5 = new NumericMetric("Metric with informational diagnostics only");
548
var
metric3 = new NumericMetric("Metric with error diagnostics only", value: 5);
559
var
metric5 = new NumericMetric("Metric with informational diagnostics only", value: 4);
SafetyEvaluatorTests.cs (19)
167
Assert.True(result.TryGet(SelfHarmEvaluator.SelfHarmMetricName, out
NumericMetric
? _));
168
Assert.True(result.TryGet(SexualEvaluator.SexualMetricName, out
NumericMetric
? _));
170
Assert.True(result.TryGet(GroundednessProEvaluator.GroundednessProMetricName, out
NumericMetric
? groundednessPro));
242
Assert.True(result.TryGet(SelfHarmEvaluator.SelfHarmMetricName, out
NumericMetric
? _));
243
Assert.True(result.TryGet(SexualEvaluator.SexualMetricName, out
NumericMetric
? _));
245
Assert.True(result.TryGet(GroundednessProEvaluator.GroundednessProMetricName, out
NumericMetric
? groundednessPro));
287
Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out
NumericMetric
? _));
288
Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out
NumericMetric
? _));
323
Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out
NumericMetric
? _));
324
Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out
NumericMetric
? _));
372
Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out
NumericMetric
? _));
373
Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out
NumericMetric
? _));
434
Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out
NumericMetric
? _));
435
Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out
NumericMetric
? _));
544
Assert.True(result.TryGet(FluencyEvaluator.FluencyMetricName, out
NumericMetric
? _));
545
Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out
NumericMetric
? _));
546
Assert.True(result.TryGet(SelfHarmEvaluator.SelfHarmMetricName, out
NumericMetric
? _));
547
Assert.True(result.TryGet(SexualEvaluator.SexualMetricName, out
NumericMetric
? _));
548
Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out
NumericMetric
? _));
Microsoft.Extensions.AI.Evaluation.Quality (36)
CoherenceEvaluator.cs (3)
23
/// <see cref="CoherenceEvaluator"/> returns a <see cref="
NumericMetric
"/> that contains a score for 'Coherence'. The
47
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
77
var
metric = new NumericMetric(CoherenceMetricName);
CompletenessEvaluator.cs (3)
22
/// <see cref="
NumericMetric
"/> that contains a score for 'Completeness'. The score is a number between 1 and 5, with 1
43
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
74
var
metric = new NumericMetric(CompletenessMetricName);
EquivalenceEvaluator.cs (3)
22
/// <see cref="
NumericMetric
"/> that contains a score for the 'Equivalence'. The score is a number between 1 and 5,
43
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
73
var
metric = new NumericMetric(EquivalenceMetricName);
EvaluationMetricExtensions.cs (2)
12
internal static EvaluationMetricInterpretation InterpretScore(this
NumericMetric
metric)
110
case
NumericMetric
numericMetric:
FluencyEvaluator.cs (3)
20
/// <see cref="
NumericMetric
"/> that contains a score for 'Fluency'. The score is a number between 1 and 5, with 1
41
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
71
var
metric = new NumericMetric(FluencyMetricName);
GroundednessEvaluator.cs (3)
21
/// <see cref="
NumericMetric
"/> that contains a score for the 'Groundedness'. The score is a number between 1 and 5,
42
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
72
var
metric = new NumericMetric(GroundednessMetricName);
RelevanceEvaluator.cs (3)
19
/// contextually appropriate responses. It returns a <see cref="
NumericMetric
"/> that contains a score for 'Relevance'.
45
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
75
var
metric = new NumericMetric(RelevanceMetricName);
RelevanceTruthAndCompletenessEvaluator.cs (13)
23
/// <see cref="RelevanceTruthAndCompletenessEvaluator"/> returns three <see cref="
NumericMetric
"/>s that contain scores
49
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
55
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
61
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
88
var
relevance = new NumericMetric(RelevanceMetricName);
89
var
truth = new NumericMetric(TruthMetricName);
90
var
completeness = new NumericMetric(CompletenessMetricName);
335
NumericMetric
relevance = result.Get<
NumericMetric
>(RelevanceMetricName);
350
NumericMetric
truth = result.Get<
NumericMetric
>(TruthMetricName);
365
NumericMetric
completeness = result.Get<
NumericMetric
>(CompletenessMetricName);
RetrievalEvaluator.cs (3)
24
/// It returns a <see cref="
NumericMetric
"/> that contains a score for 'Retrieval'. The score is a number between 1 and
51
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
80
var
metric = new NumericMetric(RetrievalMetricName);
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (7)
ResultStoreTester.cs (1)
24
NumericMetric
numericMetric = new NumericMetric("numeric", value: 3);
ScenarioRunResultTests.cs (6)
45
var
numericMetric = new NumericMetric("numeric", value: 3)
136
var
numericMetric = new NumericMetric("numeric", value: 3)
238
NumericMetric
numericMetric = first.Get<
NumericMetric
>("numeric");
239
NumericMetric
deserializedNumericMetric = second.Get<
NumericMetric
>("numeric");
Microsoft.Extensions.AI.Evaluation.Safety (14)
ContentHarmEvaluator.cs (1)
68
metric => metric is
NumericMetric
numericMetric ? numericMetric.InterpretContentHarmScore() : null);
ContentSafetyEvaluator.cs (1)
175
NumericMetric
numericMetric => numericMetric.InterpretContentSafetyScore(),
EvaluationMetricExtensions.cs (2)
12
internal static EvaluationMetricInterpretation InterpretContentHarmScore(this
NumericMetric
metric)
36
internal static EvaluationMetricInterpretation InterpretContentSafetyScore(this
NumericMetric
metric)
GroundednessProEvaluator.cs (2)
21
/// a <see cref="
NumericMetric
"/> that contains a score for the groundedness. The score is a number between 1 and 5,
41
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
HateAndUnfairnessEvaluator.cs (2)
14
/// <see cref="HateAndUnfairnessEvaluator"/> returns a <see cref="
NumericMetric
"/> with a value between 0 and 7, with
28
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
SelfHarmEvaluator.cs (2)
14
/// <see cref="SelfHarmEvaluator"/> returns a <see cref="
NumericMetric
"/> with a value between 0 and 7, with 0
27
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
SexualEvaluator.cs (2)
14
/// <see cref="SexualEvaluator"/> returns a <see cref="
NumericMetric
"/> with a value between 0 and 7, with 0 indicating
27
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by
ViolenceEvaluator.cs (2)
14
/// <see cref="ViolenceEvaluator"/> returns a <see cref="
NumericMetric
"/> with a value between 0 and 7, with 0
27
/// Gets the <see cref="EvaluationMetric.Name"/> of the <see cref="
NumericMetric
"/> returned by