def evaluate(self, X, ytrue): """ Evaluate the model based on the RMSE :type X: np.ndarray :param X: The feature array. :type ytrue: np.ndarray :param ytrue: The true label array. """ ypred, dummy = self.predict(X) return rmse(ytrue, ypred)
def evaluate(self, ytrue, mean_pred, std_pred=False): """ Negative - log -likelihood for the prediction of a gaussian probability """ if std_pred is None: return rmse(ytrue, mean_pred) else: mean = mean_pred sigma = std_pred + 1e-6 # adding 1-e6 for numerical stability reasons first = 0.5 * np.log(np.square(sigma)) second = np.square(mean - ytrue) / (2 * np.square(sigma)) summed = first + second loss = np.mean(summed, axis=-1) return loss