sgd.go
func LinearLoss(x, θ []float64, y, σ float64) float64 {
	// log((1/(2*pi*sigma**2))**0.5*exp(-1/(2*σ**2)*(y-w*x)**2))
	σ2 := math.Pow(σ, 2)
	z := math.Pow(1.0/(2*math.Pi*σ2), 0.5)
	yest := 0.0
	for i, xi := range x {
		yest += θ[i] * xi
	}
	return -math.Log(z * math.Exp(-1/(2*σ2)*math.Pow((y-yest), 2)))
}
func LinearLoss(x, θ []float64, y, σ float64) float64 {
	// log((1/(2*pi*sigma**2))**0.5*exp(-1/(2*σ**2)*(y-w*x)**2))
	σ2 := math.Pow(σ, 2)
	z := math.Pow(1.0/(2*math.Pi*σ2), 0.5)
	yest := 0.0
	for i, xi := range x {
		yest += θ[i] * xi
	}
	return -math.Log(z * math.Exp(-1/(2*σ2)*math.Pow((y-yest), 2)))
}
// Loss Functions