示例#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))
}