score

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: BSD-3-Clause Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pair

type Pair struct {
	Predicted int
	Expected  int
}

Pair of predicted and expected classification labels.

type S

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

S stores classification scores.

func Add

func Add(s, t *S) *S

Add returns the result of adding the two scores. This function leaves the original scores untouched, returning a new score structure.

func NewScore

func NewScore() *S

NewScore returns a new empty score table.

func (*S) Clear

func (s *S) Clear()

Clear clears the score table.

func (*S) ConfusionMatrix

func (s *S) ConfusionMatrix(c int) [][]int

ConfusionMatrix computes the confusion matrix of the predictions. Argument c is the number of classes.

func (*S) Evaluate

func (s *S) Evaluate(T spn.Dataset, L []int, N spn.SPN, classVar *learn.Variable)

Evaluate takes a dataset, an array of expected labels ordered according to the dataset, an SPN and the label variable, and registers each predicted and expected values of the label variable in the dataset.

func (*S) EvaluatePosterior

func (s *S) EvaluatePosterior(T spn.Dataset, L []int, N spn.SPN, classVar *learn.Variable)

EvaluatePosterior evaluates the SPN classification score by computing the exact probabilities, instead of the approximate MAP.

func (*S) EvaluatePosteriorConc

func (s *S) EvaluatePosteriorConc(D spn.Dataset, L []int, N spn.SPN, classVar *learn.Variable, k int)

EvaluatePosteriorConc runs EvaluatePosterior concurrently. Additional argument k is the number of concurrent jobs to run at a time. If k <= 0, k is set to the number of CPUs available.

func (*S) Hits

func (s *S) Hits() int

Hits returns the number of correct classifications.

func (*S) Merge

func (s *S) Merge(t *S)

Merge absorbs all the information from the given score.

func (*S) Misses

func (s *S) Misses() int

Misses returns the number of incorrect classifications.

func (*S) Register

func (s *S) Register(predicted int, expected int)

Register adds the predicted label and the expected label to the score table.

func (*S) Save

func (s *S) Save(filename string)

Save saves this score table's textual representation to a file.

func (*S) String

func (s *S) String() string

String returns the textual representation of this score table.

func (*S) Total

func (s *S) Total() int

Total returns the number of correct + incorrect classifications.

Jump to

Keyboard shortcuts

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