def calcVal(self, pred, target): diff = Blas.addVectorToVector(target.ravel(), pred.ravel(), alpha=1.0, beta=-1.0) error = Blas.dot(diff, diff) / (2.0 * np.prod(target.shape)) return error
def calcError(self, pred, target): self.devErr.fill( Blas.dot(self.grad.ravel(), self.grad.ravel()) * np.prod(self.grad.shape) * self.grad.shape[0] / 2.0) self.accumErr += self.devErr