コード例 #1
0
func (l logitLoss) GetSampleImportance(ex *pb.Example) float64 {
	prediction := l.evaluator.Evaluate(ex.Features)
	weightedLabel := 2 * ex.GetLabel() / (1 + math.Exp(2*ex.GetLabel()*prediction))
	return math.Abs(weightedLabel) * (2 - math.Abs(weightedLabel))
}
コード例 #2
0
func (l leastAbsoluteDeviationLoss) residual(ex *pb.Example) float64 {
	return ex.GetLabel() - l.evaluator.Evaluate(ex.Features)
}
コード例 #3
0
func (h huberLoss) residual(ex *pb.Example) float64 {
	return ex.GetLabel() - h.evaluator.Evaluate(ex.Features)
}