35 instantiations of NumericMetric
Microsoft.Extensions.AI.Evaluation.Integration.Tests (20)
ResultsTests.cs (20)
343var metricA = new NumericMetric("Metric with value 0", 0, reason: "Because of reason A"); 344var metricB = new NumericMetric("Metric with value 1", 1, reason: "Because of reason B"); 345var metricC = new NumericMetric("Metric with value 2", 2, reason: "Because of reason C"); 346var metricD = new NumericMetric("Metric with value 3", 3, reason: "Because of reason D"); 347var metricE = new NumericMetric("Metric with value 4", 4, reason: "Because of reason E"); 348var metricF = new NumericMetric("Metric with value 5", 5, reason: "Because of reason F"); 349var metricG = new NumericMetric("Metric with value 6", 6, reason: "Because of reason G"); 350var metricH = new NumericMetric("Metric with no value", reason: "Because of reason H"); 379var metricA = new NumericMetric("Metric with value 0", 0, reason: "Because of reason A"); 380var metricB = new NumericMetric("Metric with value 1", 1, reason: "Because of reason B"); 381var metricC = new NumericMetric("Metric with value 2", 2, reason: "Because of reason C"); 382var metricD = new NumericMetric("Metric with value 3", 3, reason: "Because of reason D"); 383var metricE = new NumericMetric("Metric with value 4", 4, reason: "Because of reason E"); 384var metricF = new NumericMetric("Metric with value 5", 5, reason: "Because of reason F"); 385var metricG = new NumericMetric("Metric with value 6", 6, reason: "Because of reason G"); 386var metricH = new NumericMetric("Metric with no value", reason: "Because of reason H"); 447var metric5 = new NumericMetric("Metric with informational diagnostics only"); 500var metric5 = new NumericMetric("Metric with informational diagnostics only"); 548var metric3 = new NumericMetric("Metric with error diagnostics only", value: 5); 559var metric5 = new NumericMetric("Metric with informational diagnostics only", value: 4);
Microsoft.Extensions.AI.Evaluation.Quality (10)
CoherenceEvaluator.cs (1)
77var metric = new NumericMetric(CoherenceMetricName);
CompletenessEvaluator.cs (1)
74var metric = new NumericMetric(CompletenessMetricName);
EquivalenceEvaluator.cs (1)
73var metric = new NumericMetric(EquivalenceMetricName);
FluencyEvaluator.cs (1)
71var metric = new NumericMetric(FluencyMetricName);
GroundednessEvaluator.cs (1)
72var metric = new NumericMetric(GroundednessMetricName);
RelevanceEvaluator.cs (1)
75var metric = new NumericMetric(RelevanceMetricName);
RelevanceTruthAndCompletenessEvaluator.cs (3)
88var relevance = new NumericMetric(RelevanceMetricName); 89var truth = new NumericMetric(TruthMetricName); 90var completeness = new NumericMetric(CompletenessMetricName);
RetrievalEvaluator.cs (1)
80var metric = new NumericMetric(RetrievalMetricName);
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (3)
ResultStoreTester.cs (1)
24NumericMetric numericMetric = new NumericMetric("numeric", value: 3);
ScenarioRunResultTests.cs (2)
45var numericMetric = new NumericMetric("numeric", value: 3) 136var numericMetric = new NumericMetric("numeric", value: 3)
Microsoft.Extensions.AI.Evaluation.Safety (2)
ContentSafetyService.cs (2)
84metric = new NumericMetric(metricName, doubleValue, reason); 97metric = 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)
105Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.RelevanceMetricName, out NumericMetric? _)); 106Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.TruthMetricName, out NumericMetric? _)); 107Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.CompletenessMetricName, out NumericMetric? _)); 108Assert.True(result.TryGet(CoherenceEvaluator.CoherenceMetricName, out NumericMetric? _)); 109Assert.True(result.TryGet(FluencyEvaluator.FluencyMetricName, out NumericMetric? _)); 110Assert.True(result.TryGet(RelevanceEvaluator.RelevanceMetricName, out NumericMetric? _)); 144Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.RelevanceMetricName, out NumericMetric? _)); 145Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.TruthMetricName, out NumericMetric? _)); 146Assert.True(result.TryGet(RelevanceTruthAndCompletenessEvaluator.CompletenessMetricName, out NumericMetric? _)); 147Assert.True(result.TryGet(CoherenceEvaluator.CoherenceMetricName, out NumericMetric? _)); 148Assert.True(result.TryGet(FluencyEvaluator.FluencyMetricName, out NumericMetric? _)); 149Assert.True(result.TryGet(RelevanceEvaluator.RelevanceMetricName, out NumericMetric? _)); 181Assert.True(result.TryGet(GroundednessEvaluator.GroundednessMetricName, out NumericMetric? groundedness)); 182Assert.True(result.TryGet(EquivalenceEvaluator.EquivalenceMetricName, out NumericMetric? equivalence)); 183Assert.True(result.TryGet(CompletenessEvaluator.CompletenessMetricName, out NumericMetric? completeness)); 184Assert.True(result.TryGet(RetrievalEvaluator.RetrievalMetricName, out NumericMetric? retrieval)); 255Assert.True(result.TryGet(GroundednessEvaluator.GroundednessMetricName, out NumericMetric? groundedness)); 256Assert.True(result.TryGet(EquivalenceEvaluator.EquivalenceMetricName, out NumericMetric? equivalence)); 257Assert.True(result.TryGet(CompletenessEvaluator.CompletenessMetricName, out NumericMetric? completeness)); 258Assert.True(result.TryGet(RetrievalEvaluator.RetrievalMetricName, out NumericMetric? retrieval));
ResultsTests.cs (22)
73case NumericMetric numericMetric: 109(m is NumericMetric s && s.Value is not null) || 343var metricA = new NumericMetric("Metric with value 0", 0, reason: "Because of reason A"); 344var metricB = new NumericMetric("Metric with value 1", 1, reason: "Because of reason B"); 345var metricC = new NumericMetric("Metric with value 2", 2, reason: "Because of reason C"); 346var metricD = new NumericMetric("Metric with value 3", 3, reason: "Because of reason D"); 347var metricE = new NumericMetric("Metric with value 4", 4, reason: "Because of reason E"); 348var metricF = new NumericMetric("Metric with value 5", 5, reason: "Because of reason F"); 349var metricG = new NumericMetric("Metric with value 6", 6, reason: "Because of reason G"); 350var metricH = new NumericMetric("Metric with no value", reason: "Because of reason H"); 379var metricA = new NumericMetric("Metric with value 0", 0, reason: "Because of reason A"); 380var metricB = new NumericMetric("Metric with value 1", 1, reason: "Because of reason B"); 381var metricC = new NumericMetric("Metric with value 2", 2, reason: "Because of reason C"); 382var metricD = new NumericMetric("Metric with value 3", 3, reason: "Because of reason D"); 383var metricE = new NumericMetric("Metric with value 4", 4, reason: "Because of reason E"); 384var metricF = new NumericMetric("Metric with value 5", 5, reason: "Because of reason F"); 385var metricG = new NumericMetric("Metric with value 6", 6, reason: "Because of reason G"); 386var metricH = new NumericMetric("Metric with no value", reason: "Because of reason H"); 447var metric5 = new NumericMetric("Metric with informational diagnostics only"); 500var metric5 = new NumericMetric("Metric with informational diagnostics only"); 548var metric3 = new NumericMetric("Metric with error diagnostics only", value: 5); 559var metric5 = new NumericMetric("Metric with informational diagnostics only", value: 4);
SafetyEvaluatorTests.cs (19)
167Assert.True(result.TryGet(SelfHarmEvaluator.SelfHarmMetricName, out NumericMetric? _)); 168Assert.True(result.TryGet(SexualEvaluator.SexualMetricName, out NumericMetric? _)); 170Assert.True(result.TryGet(GroundednessProEvaluator.GroundednessProMetricName, out NumericMetric? groundednessPro)); 242Assert.True(result.TryGet(SelfHarmEvaluator.SelfHarmMetricName, out NumericMetric? _)); 243Assert.True(result.TryGet(SexualEvaluator.SexualMetricName, out NumericMetric? _)); 245Assert.True(result.TryGet(GroundednessProEvaluator.GroundednessProMetricName, out NumericMetric? groundednessPro)); 287Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out NumericMetric? _)); 288Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out NumericMetric? _)); 323Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out NumericMetric? _)); 324Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out NumericMetric? _)); 372Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out NumericMetric? _)); 373Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out NumericMetric? _)); 434Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out NumericMetric? _)); 435Assert.True(result.TryGet(ViolenceEvaluator.ViolenceMetricName, out NumericMetric? _)); 544Assert.True(result.TryGet(FluencyEvaluator.FluencyMetricName, out NumericMetric? _)); 545Assert.True(result.TryGet(HateAndUnfairnessEvaluator.HateAndUnfairnessMetricName, out NumericMetric? _)); 546Assert.True(result.TryGet(SelfHarmEvaluator.SelfHarmMetricName, out NumericMetric? _)); 547Assert.True(result.TryGet(SexualEvaluator.SexualMetricName, out NumericMetric? _)); 548Assert.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 77var 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 74var 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 73var metric = new NumericMetric(EquivalenceMetricName);
EvaluationMetricExtensions.cs (2)
12internal static EvaluationMetricInterpretation InterpretScore(this NumericMetric metric) 110case 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 71var 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 72var 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 75var 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 88var relevance = new NumericMetric(RelevanceMetricName); 89var truth = new NumericMetric(TruthMetricName); 90var completeness = new NumericMetric(CompletenessMetricName); 335NumericMetric relevance = result.Get<NumericMetric>(RelevanceMetricName); 350NumericMetric truth = result.Get<NumericMetric>(TruthMetricName); 365NumericMetric 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 80var metric = new NumericMetric(RetrievalMetricName);
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (7)
ResultStoreTester.cs (1)
24NumericMetric numericMetric = new NumericMetric("numeric", value: 3);
ScenarioRunResultTests.cs (6)
45var numericMetric = new NumericMetric("numeric", value: 3) 136var numericMetric = new NumericMetric("numeric", value: 3) 238NumericMetric numericMetric = first.Get<NumericMetric>("numeric"); 239NumericMetric deserializedNumericMetric = second.Get<NumericMetric>("numeric");
Microsoft.Extensions.AI.Evaluation.Safety (14)
ContentHarmEvaluator.cs (1)
68metric => metric is NumericMetric numericMetric ? numericMetric.InterpretContentHarmScore() : null);
ContentSafetyEvaluator.cs (1)
175NumericMetric numericMetric => numericMetric.InterpretContentSafetyScore(),
EvaluationMetricExtensions.cs (2)
12internal static EvaluationMetricInterpretation InterpretContentHarmScore(this NumericMetric metric) 36internal 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