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)) }
// 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)) }