Share via


NumericMetric Class

Definition

An EvaluationMetric containing a numeric value.

public ref class NumericMetric sealed : Microsoft::Extensions::AI::Evaluation::EvaluationMetric<Nullable<double>>
public sealed class NumericMetric : Microsoft.Extensions.AI.Evaluation.EvaluationMetric<double?>
type NumericMetric = class
    inherit EvaluationMetric<Nullable<double>>
Public NotInheritable Class NumericMetric
Inherits EvaluationMetric(Of Nullable(Of Double))
Inheritance

Remarks

NumericMetric can be used to represent any numeric value. The underlying type of a NumericMetric's value is double. However, it can be used to represent any type of numeric value including int, long, float etc.

A common use case for NumericMetric is to represent numeric scores that fall within a well defined range. For example, it can be used to represent a score between 1 and 5, where 1 is considered a poor score, and 5 is considered an excellent score.

Constructors

NumericMetric(String, Nullable<Double>, String)

An EvaluationMetric containing a numeric value.

Properties

Diagnostics

Gets or sets a collection of zero or more EvaluationDiagnostics associated with the current EvaluationMetric.

(Inherited from EvaluationMetric)
Interpretation

Gets or sets an EvaluationMetricInterpretation that identifies whether the result of the evaluation represented by the current EvaluationMetric is considered good or bad, passed or failed etc.

(Inherited from EvaluationMetric)
Metadata

Gets or sets a collection of zero or more string metadata associated with the current EvaluationMetric.

(Inherited from EvaluationMetric)
Name

Gets or sets the name of the EvaluationMetric.

(Inherited from EvaluationMetric)
Reason

Gets or sets a string that can optionally be used to provide some commentary around the result represented by this EvaluationMetric.

(Inherited from EvaluationMetric)
Value

Gets or sets the value of the EvaluationMetric<T>.

(Inherited from EvaluationMetric<T>)

Extension Methods

AddDiagnostic(EvaluationMetric, EvaluationDiagnostic)

Adds the supplied EvaluationDiagnostic to the supplied EvaluationMetric's Diagnostics collection.

AddDiagnostics(EvaluationMetric, EvaluationDiagnostic[])

Adds the supplied EvaluationDiagnostics to the supplied EvaluationMetric's Diagnostics collection.

AddDiagnostics(EvaluationMetric, IEnumerable<EvaluationDiagnostic>)

Adds the supplied EvaluationDiagnostics to the supplied EvaluationMetric's Diagnostics collection.

AddOrUpdateMetadata(EvaluationMetric, IDictionary<String,String>)

Adds or updates the supplied to the supplied EvaluationMetric's Metadata collection.

AddOrUpdateMetadata(EvaluationMetric, String, String)

Adds or updates metadata with the specified name and value in the supplied EvaluationMetric's Metadata collection.

ContainsDiagnostics(EvaluationMetric, Func<EvaluationDiagnostic,Boolean>)

Returns true if the supplied metric contains any EvaluationDiagnostic matching the supplied predicate; false otherwise.

Applies to

See also