Class FMeasure

Namespace
NOpenNLP.Tools.Util.Eval
Assembly
NOpenNLP.Tools.dll

The FMeasure is an utility class for evaluators which measure precision, recall and the resulting f-measure.

Evaluation results are the arithmetic mean of the precision scores calculated for each reference sample and the arithmetic mean of the recall scores calculated for each reference sample.

public sealed class FMeasure
Inheritance
FMeasure
Inherited Members

Properties

PrecisionScore

Retrieves the arithmetic mean of the precision scores calculated for each evaluated sample.

public double PrecisionScore { get; }

Property Value

double

the arithmetic mean of all precision scores

RecallScore

Retrieves the arithmetic mean of the recall score calculated for each evaluated sample.

public double RecallScore { get; }

Property Value

double

the arithmetic mean of all recall scores

Value

Retrieves the f-measure score.

f-measure = 2 * precision * recall / (precision + recall)

public double Value { get; }

Property Value

double

the f-measure or -1 if precision + recall <= 0

Methods

MergeInto(FMeasure)

Merge results into fmeasure metric.

public void MergeInto(FMeasure measure)

Parameters

measure FMeasure

the fmeasure

Precision(object[], object[])

Calculates the precision score for the given reference and predicted spans.

public static double Precision(object[] references, object[] predictions)

Parameters

references object[]

the gold standard spans

predictions object[]

the predicted spans

Returns

double

the precision score or NaN if there are no predicted spans

Recall(object[], object[])

Calculates the recall score for the given reference and predicted spans.

public static double Recall(object[] references, object[] predictions)

Parameters

references object[]

the gold standard spans

predictions object[]

the predicted spans

Returns

double

the recall score or NaN if there are no reference spans

ToString()

Creates a human read-able string representation.

public override string ToString()

Returns

string

the results

UpdateScores(object[], object[])

Updates the score based on the number of true positives and the number of predictions and references.

public void UpdateScores(object[] references, object[] predictions)

Parameters

references object[]

the provided references

predictions object[]

the predicted spans