diff --git a/smt/surrogate_models/krg_based.py b/smt/surrogate_models/krg_based.py index f06443827..0011034d3 100644 --- a/smt/surrogate_models/krg_based.py +++ b/smt/surrogate_models/krg_based.py @@ -1667,6 +1667,8 @@ def _predict_variances(self, x: np.ndarray, is_acting=None) -> np.ndarray: ) A = self.optimal_par["sigma2"] B = 1.0 - (rt**2.0).sum(axis=0) + (u**2.0).sum(axis=0) + # machine precision: force to zero! + B[B<1e-12]=0 MSE = np.einsum("i,j -> ji", A, B) # Mean Squared Error might be slightly negative depending on # machine precision: force to zero!