metrics

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyMatch

func AnyMatch(expected, actual map[string]interface{}) float64

AnyMatch checks if any of the predicted answers match the expected answer for all fields.

func ExactMatch

func ExactMatch(expected, actual map[string]interface{}) float64

ExactMatch checks if the predicted answer exactly matches the expected answer for all fields.

func F1Score

func F1Score(expected, actual map[string]interface{}) float64

F1Score calculates the F1 score between the expected and actual answers.

Types

type Accuracy

type Accuracy struct {
	MetricFunc MetricFunc
}

Accuracy is a struct that can be used to create customizable accuracy metrics.

func NewAccuracy

func NewAccuracy(metricFunc MetricFunc) *Accuracy

NewAccuracy creates a new Accuracy metric with the specified metric function.

func (*Accuracy) Evaluate

func (a *Accuracy) Evaluate(expected, actual map[string]interface{}) float64

Evaluate applies the metric function to the expected and actual outputs.

type MetricFunc

type MetricFunc func(expected, actual map[string]interface{}) float64

MetricFunc is a type alias for metric functions.

Jump to

Keyboard shortcuts

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