Documentation ¶
Index ¶
- func GetAUC(points [][2]float64) (float64, error)
- func GetCoordinates(points [][3]float64) [][2]float64
- func GetMSE(yReal []float64, yPred []float64) (float64, error)
- func GetRMSE(yReal []float64, yPred []float64) (float64, error)
- func GetROC(realClasses []string, predValues []float64, class string) ([][3]float64, error)
- type ConfusionMatrix
- func (cm ConfusionMatrix) GetAccuracy() float64
- func (cm ConfusionMatrix) GetF1Score(class string) (float64, error)
- func (cm ConfusionMatrix) GetFPR(class string) (float64, error)
- func (cm ConfusionMatrix) GetFalseNegatives(class string) (float64, error)
- func (cm ConfusionMatrix) GetFalsePositives(class string) (float64, error)
- func (cm ConfusionMatrix) GetPrecision(class string) (float64, error)
- func (cm ConfusionMatrix) GetRecall(class string) (float64, error)
- func (cm ConfusionMatrix) GetTPR(class string) (float64, error)
- func (cm ConfusionMatrix) GetTrueNegatives(class string) (float64, error)
- func (cm ConfusionMatrix) GetTruePositives(class string) (float64, error)
- func (cm ConfusionMatrix) String() string
- func (cm ConfusionMatrix) Summary() string
- func (cm ConfusionMatrix) SummaryAsJSON() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAUC ¶
GetAUC returns auc of the roc which is expressed by a series of points, points is sorted by FPR in monotonic increasing or monotonic order.
func GetCoordinates ¶
GetCoordinates get the abscissa and ordinate of the point represented as [Xi,Yi,Tag], return [[Xi,Yi],...]
func GetMSE ¶
GetMSE returns Mean Squared Error which measures the average of the squares of the errors, that is, the average squared difference between the estimated values and the actual value.
func GetROC ¶
- GetROC
- Compute Receiver operating characteristic(roc).
- PARAMS:
- - realClasses []string: Real labels of sample set
- - predValues []float64: Predicted Target scores, which corresponds to the sample in 'realClasses', are probability estimates of the next param 'class'.
- - class string: The positive label in roc.
- RERURNS:
- - [][3]float64: a series of points on roc, the point is represented as [FPR, TPR, threshold]([x,y,threshold])
- FPR = FP / (TN + FP), TPR = TP / (TP + FN)
- - error: nil if succeed, error if fail
Types ¶
type ConfusionMatrix ¶
ConfusionMatrix is a nested map of actual and predicted class counts
func NewConfusionMatrix ¶
func NewConfusionMatrix(realClasses []string, predClasses []string) (ConfusionMatrix, error)
NewConfusionMatrix builds a ConfusionMatrix from a set of real class value (`realClasses') and a set of predicted class value (`predClasses'). The same index of realClasses and predClasses must refer to the same sample
func (ConfusionMatrix) GetAccuracy ¶
func (cm ConfusionMatrix) GetAccuracy() float64
GetAccuracy computes the overall classification accuracy. That is (number of correctly classified instances) / total instances
func (ConfusionMatrix) GetF1Score ¶
func (cm ConfusionMatrix) GetF1Score(class string) (float64, error)
GetF1Score computes the harmonic mean of Precision and Recall (equivalently called F-measure).
func (ConfusionMatrix) GetFPR ¶
func (cm ConfusionMatrix) GetFPR(class string) (float64, error)
GetFPR returns FPR which means the fraction of the misclassified samples which were not given class actually in all samples which were not given class actually.
func (ConfusionMatrix) GetFalseNegatives ¶
func (cm ConfusionMatrix) GetFalseNegatives(class string) (float64, error)
GetFalseNegatives returns FN which means the number of times an entry is incorrectly predicted as something other than the given class.
func (ConfusionMatrix) GetFalsePositives ¶
func (cm ConfusionMatrix) GetFalsePositives(class string) (float64, error)
GetFalsePositives returns FP which means the number of times an entry is incorrectly predicted in the ConfusionMatrix.
func (ConfusionMatrix) GetPrecision ¶
func (cm ConfusionMatrix) GetPrecision(class string) (float64, error)
GetPrecision returns Precision which means the correctly predicted fraction of the total predictions for a given class.
func (ConfusionMatrix) GetRecall ¶
func (cm ConfusionMatrix) GetRecall(class string) (float64, error)
GetRecall returns Recall which means the fraction of the total occurrences of a given class which were predicted.
func (ConfusionMatrix) GetTPR ¶
func (cm ConfusionMatrix) GetTPR(class string) (float64, error)
GetTPR returns TPR which means the fraction of the total occurrences of a given class which were predicted.
func (ConfusionMatrix) GetTrueNegatives ¶
func (cm ConfusionMatrix) GetTrueNegatives(class string) (float64, error)
GetTrueNegatives returns TN which means the number of times an entry is correctly predicted as something other than the given class.
func (ConfusionMatrix) GetTruePositives ¶
func (cm ConfusionMatrix) GetTruePositives(class string) (float64, error)
GetTruePositives returns TP which means the number of times an entry is predicted correctly in the ConfusionMatrix.
func (ConfusionMatrix) String ¶
func (cm ConfusionMatrix) String() string
String returns a human-readable version of the ConfusionMatrix.
func (ConfusionMatrix) Summary ¶
func (cm ConfusionMatrix) Summary() string
Summary returns a table of precision, recall, f1, true positive, false positive, true negatives and false negatives for each class, and accuracy.
func (ConfusionMatrix) SummaryAsJSON ¶
func (cm ConfusionMatrix) SummaryAsJSON() ([]byte, error)
SummaryAsJSON returns a json bytes of precision, recall, f1, true positive, false positive, true negatives and false negatives for each class, and accuracy. JSON type summary is something like :
{ "Metrics": { "NO": { "TP": 2, "FP": 1, "FN": 1, "TN": 4, "Precision": 0.6666666666666666, "Recall": 0.6666666666666666, "F1Score": 0.6666666666666666 }, "YES": { "TP": 4, "FP": 1, "FN": 1, "TN": 2, "Precision": 0.8, "Recall": 0.8, "F1Score": 0.8000000000000002 } }, "Accuracy": 0.75 }
NO and Yes are classes