예제 #1
0
파일: mlp.go 프로젝트: nickpoorman/nnet
func (d *MLP) MeanSquareErr(input, target [][]float64) float64 {
	sum := 0.0
	for i := 0; i < len(target); i++ {
		sum += nnet.SquareErrBetweenTwoVector(d.Forward(input[i]), target[i])
	}
	return 0.5 * sum / float64(len(target))
}
예제 #2
0
파일: gbrbm.go 프로젝트: nickpoorman/nnet
// ReconstructionError returns reconstruction error.
// Use mean of Gaussian when computing reconstruction error.
func (rbm *GBRBM) ReconstructionError(data [][]float64, numSteps int) float64 {
	err := 0.0
	for _, v := range data {
		reconstructed := rbm.Reconstruct(v, numSteps, true)
		err += nnet.SquareErrBetweenTwoVector(v, reconstructed)
	}
	return 0.5 * err / float64(len(data))
}