confusion

package
v1.1.50 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: BSD-3-Clause Imports: 5 Imported by: 3

README

Docs: GoDoc

Confusion implements a confusion matrix: records output responses for discrete categories / classes.

  • Rows (outer dimension) are for each class as the ground truth, correct answer.

  • Columns (inner dimension) are the response generated for each ground-truth class.

The main result is in the Prob field, computed from the Sum and N values added incrementally.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KiT_Matrix = kit.Types.AddType(&Matrix{}, MatrixProps)
View Source
var MatrixProps = ki.Props{
	"ToolBar": ki.PropSlice{
		{"SaveCSV", ki.Props{
			"label": "Save CSV...",
			"icon":  "file-save",
			"desc":  "Save CSV-formatted confusion probabilities (Probs)",
			"Args": ki.PropSlice{
				{"CSV File Name", ki.Props{
					"ext": ".csv",
				}},
			},
		}},
		{"OpenCSV", ki.Props{
			"label": "Open CSV...",
			"icon":  "file-open",
			"desc":  "Open CSV-formatted confusion probabilities (Probs)",
			"Args": ki.PropSlice{
				{"Weights File Name", ki.Props{
					"ext": ".csv",
				}},
			},
		}},
	},
}

Functions

This section is empty.

Types

type Matrix

type Matrix struct {
	Prob etensor.Float64 `view:"no-inline" desc:"normalized probability of confusion: Row = ground truth class, Col = actual response for that class."`
	Sum  etensor.Float64 `view:"no-inline" desc:"incremental sums"`
	N    etensor.Float64 `view:"no-inline" desc:"counts per ground truth (rows)"`
	Vis  simat.SimMat    `view:"no-inline" desc:"visualization using SimMat"`
}

Matrix computes the confusion matrix, with rows representing the ground truth correct class, and columns representing the actual answer produced. Correct answers are along the diagonal.

func (*Matrix) Incr

func (cm *Matrix) Incr(class, resp int)

Incr increments the data for given class ground truth and response.

func (*Matrix) Init

func (cm *Matrix) Init(n int)

Init initializes the Matrix for given number of classes, and resets the data to zero.

func (*Matrix) OpenCSV

func (cm *Matrix) OpenCSV(filename gi.FileName)

OpenCSV opens Prob result from a CSV file, comma separated

func (*Matrix) Probs

func (cm *Matrix) Probs()

Probs computes the probabilities based on accumulated data

func (*Matrix) SaveCSV

func (cm *Matrix) SaveCSV(filename gi.FileName)

SaveCSV saves Prob result to a CSV file, comma separated

func (*Matrix) SetLabels added in v1.1.34

func (cm *Matrix) SetLabels(lbls []string)

SetLabels sets the class labels, for visualization in Vis

Jump to

Keyboard shortcuts

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