eval

package
v0.0.0-...-b7c488f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Package eval contains implementations of different evaluation measures for information retrieval.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Recall calculates recall.
	Recall = recall{}
	// Precision calculates precision.
	Precision = precision{}
	// NumRel is the number of relevant documents.
	NumRel = numRel{}
	// NumRet is the number of retrieved documents.
	NumRet = numRet{}
	// NumRelRet is the number of relevant documents retrieved.
	NumRelRet = numRelRet{}

	// F1Measure is f-measure with beta=1.
	F1Measure = FMeasure{/* contains filtered or unexported fields */}
	// F05Measure is f-measure with beta=0.5.
	F05Measure = FMeasure{/* contains filtered or unexported fields */}
	// F3Measure is f-measure with beta=3.
	F3Measure = FMeasure{/* contains filtered or unexported fields */}
)
View Source
var (
	AP = ap{}
)
View Source
var (
	// NNR computes the number of documents needed to read.
	// Or in other words, the gain required per relevant document.
	NNR = numberNeededToRead{}
)
View Source
var RelevanceGrade int64 = 1

Functions

func Evaluate

func Evaluate(evaluators []Evaluator, results *trecresults.ResultList, qrels trecresults.QrelsFile, topic string) map[string]float64

Evaluate scores documents using supplied evaluation measurements.

Types

type DCG

type DCG struct{ K int }

func (DCG) Name

func (e DCG) Name() string

func (DCG) Score

func (e DCG) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64

type Evaluator

type Evaluator interface {
	Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64
	Name() string
}

Evaluator is an interface for evaluating a retrieved list of documents.

func NewWSSEvaluator

func NewWSSEvaluator(collectionSize float64) Evaluator

type FMeasure

type FMeasure struct {
	// contains filtered or unexported fields
}

FMeasure computes f-measure, with the beta parameter controlling the precision and recall trade-off.

func (FMeasure) Name

func (f FMeasure) Name() string

Name calculates the name of the f-measure with beta parameter.

func (FMeasure) Score

func (f FMeasure) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64

Score uses the beta parameter to compute f-measure.

type MaximumLikelihoodEvaluator

type MaximumLikelihoodEvaluator struct {
	Evaluator
}

MaximumLikelihoodEvaluator is similar to ResidualEvaluator, except that the proportion of the residual that should be labelled relevant is computed as a maximum likelihood probability. That is, the number of unjudged documents that should be labelled with explicit positive relevance labels is computed using the ratio of relevant documents to non-relevant documents.

func NewMaximumLikelihoodEvaluator

func NewMaximumLikelihoodEvaluator(evaluator Evaluator) MaximumLikelihoodEvaluator

NewMaximumLikelihoodEvaluator creates a new mle residual evaluator by wrapping an existing evaluation metric.

func (MaximumLikelihoodEvaluator) Name

func (MaximumLikelihoodEvaluator) Probability

func (m MaximumLikelihoodEvaluator) Probability(qrels trecresults.Qrels) int64

Probability computes the maximum likelihood that a given unjudged document can be considered relevant.

func (MaximumLikelihoodEvaluator) Residual

func (MaximumLikelihoodEvaluator) Score

type NDCG

type NDCG struct{ K int }

func (NDCG) Name

func (e NDCG) Name() string

func (NDCG) Score

func (e NDCG) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64

type PrecisionAtK

type PrecisionAtK struct{ K int }

func (PrecisionAtK) Name

func (e PrecisionAtK) Name() string

func (PrecisionAtK) Score

func (e PrecisionAtK) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64

type RecallAtK

type RecallAtK struct{ K int }

func (RecallAtK) Name

func (e RecallAtK) Name() string

func (RecallAtK) Score

func (e RecallAtK) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64

type ResidualEvaluator

type ResidualEvaluator struct {
	Evaluator
}

ResidualEvaluator evaluates using an evaluator in the same manner, however it considers all unjudged documents as relevant.

func NewResidualEvaluator

func NewResidualEvaluator(evaluator Evaluator) ResidualEvaluator

NewResidualEvaluator creates a new evaluator which wraps an existing evaluator.

func (ResidualEvaluator) Name

func (r ResidualEvaluator) Name() string

func (ResidualEvaluator) Residual

Residual is the set of unjudged documents that are retrieved by a query. That is, the documents that do not have explicit relevance labels.

func (ResidualEvaluator) Score

type WorkSavedOverSampling

type WorkSavedOverSampling struct{ N float64 }

func (WorkSavedOverSampling) Name

func (WorkSavedOverSampling) Score

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL