Documentation ¶
Overview ¶
Package eval contains implementations of different evaluation measures for information retrieval.
Index ¶
- Variables
- func Evaluate(evaluators []Evaluator, results *trecresults.ResultList, ...) map[string]float64
- type DCG
- type Evaluator
- type FMeasure
- type MaximumLikelihoodEvaluator
- func (m MaximumLikelihoodEvaluator) Name() string
- func (m MaximumLikelihoodEvaluator) Probability(qrels trecresults.Qrels) int64
- func (m MaximumLikelihoodEvaluator) Residual(results *trecresults.ResultList, qrels trecresults.Qrels) trecresults.Qrels
- func (m MaximumLikelihoodEvaluator) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64
- type NDCG
- type PrecisionAtK
- type RecallAtK
- type ResidualEvaluator
- type WorkSavedOverSampling
Constants ¶
This section is empty.
Variables ¶
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 */} )
var (
AP = ap{}
)
var ( // NNR computes the number of documents needed to read. // Or in other words, the gain required per relevant document. NNR = numberNeededToRead{} )
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) 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 ¶
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) 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 (m MaximumLikelihoodEvaluator) Name() string
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 (m MaximumLikelihoodEvaluator) Residual(results *trecresults.ResultList, qrels trecresults.Qrels) trecresults.Qrels
func (MaximumLikelihoodEvaluator) Score ¶
func (m MaximumLikelihoodEvaluator) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64
type NDCG ¶
type NDCG struct{ K int }
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) 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 ¶
func (r ResidualEvaluator) Residual(results *trecresults.ResultList, qrels trecresults.Qrels) trecresults.Qrels
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 ¶
func (r ResidualEvaluator) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64
type WorkSavedOverSampling ¶
type WorkSavedOverSampling struct{ N float64 }
func (WorkSavedOverSampling) Name ¶
func (WorkSavedOverSampling) Name() string
func (WorkSavedOverSampling) Score ¶
func (w WorkSavedOverSampling) Score(results *trecresults.ResultList, qrels trecresults.Qrels) float64