Documentation
¶
Index ¶
- type ClassMetrics
- func (c *ClassMetrics) Accuracy() mat.Float
- func (c *ClassMetrics) ExpectedPos() int
- func (c *ClassMetrics) F1Score() mat.Float
- func (c *ClassMetrics) IncFalseNeg()
- func (c *ClassMetrics) IncFalsePos()
- func (c *ClassMetrics) IncTrueNeg()
- func (c *ClassMetrics) IncTruePos()
- func (c *ClassMetrics) Precision() mat.Float
- func (c *ClassMetrics) Recall() mat.Float
- func (c *ClassMetrics) Reset()
- func (c *ClassMetrics) Specificity() mat.Float
- type MovingAvg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClassMetrics ¶
type ClassMetrics struct { TruePos int // The number of true positive results (correctly marked as positive) TrueNeg int // The number of true negative results (correctly marked as negative) FalsePos int // The number of false positive results (that should have been negative) FalseNeg int // The number of false negative results (that should have been positive) }
ClassMetrics provides methods to calculate Precision, Recall, F1Score, Accuracy and other metrics useful to analyze the accuracy of a classifier.
func NewMetricCounter ¶
func NewMetricCounter() *ClassMetrics
NewMetricCounter returns a new ClassMetrics ready-to-use.
func (*ClassMetrics) Accuracy ¶
func (c *ClassMetrics) Accuracy() mat.Float
Accuracy returns the accuracy metric, calculated as (true positive + true negative) / (TP + TN + FP + FN).
func (*ClassMetrics) ExpectedPos ¶
func (c *ClassMetrics) ExpectedPos() int
ExpectedPos returns the sum of true positive and false negative
func (*ClassMetrics) F1Score ¶
func (c *ClassMetrics) F1Score() mat.Float
F1Score returns the harmonic mean of precision and recall, calculated as 2 * (precision * recall / (precision + recall))
func (*ClassMetrics) IncFalseNeg ¶
func (c *ClassMetrics) IncFalseNeg()
IncFalseNeg increments the false negative.
func (*ClassMetrics) IncFalsePos ¶
func (c *ClassMetrics) IncFalsePos()
IncFalsePos increments the false positive.
func (*ClassMetrics) IncTrueNeg ¶
func (c *ClassMetrics) IncTrueNeg()
IncTrueNeg increments the true negative.
func (*ClassMetrics) IncTruePos ¶
func (c *ClassMetrics) IncTruePos()
IncTruePos increments the true positive.
func (*ClassMetrics) Precision ¶
func (c *ClassMetrics) Precision() mat.Float
Precision returns the precision metric, calculated as true positive / (true positive + false positive).
func (*ClassMetrics) Recall ¶
func (c *ClassMetrics) Recall() mat.Float
Recall returns the recall (true positive rate) metric, calculated as true positive / (true positive + false negative).
func (*ClassMetrics) Specificity ¶
func (c *ClassMetrics) Specificity() mat.Float
Specificity returns the specificity (selectivity, true negative rate) metric, calculated as true negative / (true negative + false positive).