evaluation

package
v1.0.51 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccuracy

func GetAccuracy(c ConfusionMatrix) float64

GetAccuracy computes the overall classification accuracy That is (number of correctly classified instances) / total instances

func GetConfusionMatrix

func GetConfusionMatrix(ref base.FixedDataGrid, gen base.FixedDataGrid) (map[string]map[string]int, error)

GetConfusionMatrix builds a ConfusionMatrix from a set of reference (`ref') and generate (`gen') Instances.

func GetCrossValidatedMetric

func GetCrossValidatedMetric(in []ConfusionMatrix, metric func(ConfusionMatrix) float64) (mean, variance float64)

GetCrossValidatedMetric returns the mean and variance of the confusion-matrix-derived metric across all folds.

func GetF1Score

func GetF1Score(class string, c ConfusionMatrix) float64

GetF1Score computes the harmonic mean of precision and recall (equivalently called F-measure)

func GetFalseNegatives

func GetFalseNegatives(class string, c ConfusionMatrix) float64

GetFalseNegatives returns the number of times an entry is incorrectly predicted as something other than the given class.

func GetFalsePositives

func GetFalsePositives(class string, c ConfusionMatrix) float64

GetFalsePositives returns the number of times an entry is incorrectly predicted as having a given class.

func GetMacroPrecision

func GetMacroPrecision(c ConfusionMatrix) float64

GetMacroPrecision assesses Classifier performance across all classes by averaging the precision measures achieved for each class.

func GetMacroRecall

func GetMacroRecall(c ConfusionMatrix) float64

GetMacroRecall assesses Classifier performance across all classes by averaging the recall measures achieved for each class

func GetMicroPrecision

func GetMicroPrecision(c ConfusionMatrix) float64

GetMicroPrecision assesses Classifier performance across all classes using the total true positives and false positives.

func GetMicroRecall

func GetMicroRecall(c ConfusionMatrix) float64

GetMicroRecall assesses Classifier performance across all classes using the total true positives and false negatives.

func GetPrecision

func GetPrecision(class string, c ConfusionMatrix) float64

GetPrecision returns the fraction of of the total predictions for a given class which were correct.

func GetRecall

func GetRecall(class string, c ConfusionMatrix) float64

GetRecall returns the fraction of the total occurrences of a given class which were predicted.

func GetSummary

func GetSummary(c ConfusionMatrix) string

GetSummary returns a table of precision, recall, true positive, false positive, and true negatives for each class for a given ConfusionMatrix

func GetTrueNegatives

func GetTrueNegatives(class string, c ConfusionMatrix) float64

GetTrueNegatives returns the number of times an entry is correctly predicted as something other than the given class.

func GetTruePositives

func GetTruePositives(class string, c ConfusionMatrix) float64

GetTruePositives returns the number of times an entry is predicted successfully in a given ConfusionMatrix.

func ShowConfusionMatrix

func ShowConfusionMatrix(c ConfusionMatrix) string

ShowConfusionMatrix return a human-readable version of a given ConfusionMatrix.

Types

type ConfusionMatrix

type ConfusionMatrix map[string]map[string]int

ConfusionMatrix is a nested map of actual and predicted class counts

func GenerateCrossFoldValidationConfusionMatrices

func GenerateCrossFoldValidationConfusionMatrices(data base.FixedDataGrid, cls base.Classifier, folds int) ([]ConfusionMatrix, error)

GenerateCrossFoldValidationConfusionMatrices divides the data into a number of folds then trains and evaluates the classifier on each fold, producing a new ConfusionMatrix.

Jump to

Keyboard shortcuts

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