diff --git a/smt/utils/misc.py b/smt/utils/misc.py index 37935b59c..f136d18af 100644 --- a/smt/utils/misc.py +++ b/smt/utils/misc.py @@ -108,7 +108,7 @@ def compute_relative_error(sm, xe=None, ye=None, kx=None): return num / den -def compute_pva_error(sm, xe, ye): +def compute_pva(sm, xe, ye): ye = ye.reshape((xe.shape[0], 1)) N = len(ye) ye2 = sm.predict_values(xe) @@ -119,7 +119,7 @@ def compute_pva_error(sm, xe, ye): return pva -def compute_rmse_error(sm, xe, ye): +def compute_rmse(sm, xe, ye): ye = ye.reshape((xe.shape[0], 1)) N = len(ye) ye2 = sm.predict_values(xe) @@ -127,10 +127,10 @@ def compute_rmse_error(sm, xe, ye): return rmse -def compute_q2_error(sm, xe, ye): +def compute_q2(sm, xe, ye): ye = ye.reshape((xe.shape[0], 1)) N = len(ye) - square_rmse = compute_rmse_error(sm, xe, ye) ** 2 + square_rmse = compute_rmse(sm, xe, ye) ** 2 ye_mean = np.mean(ye) variance = np.sum((ye - ye_mean) ** 2) / N Q2 = 1 - (square_rmse / variance) diff --git a/smt/utils/test/test_misc_utils.py b/smt/utils/test/test_misc_utils.py index 1c920e23a..1685f293e 100644 --- a/smt/utils/test/test_misc_utils.py +++ b/smt/utils/test/test_misc_utils.py @@ -9,9 +9,9 @@ import numpy as np from smt.utils.misc import ( - compute_q2_error, - compute_pva_error, - compute_rmse_error, + compute_q2, + compute_pva, + compute_rmse, standardization, ) from smt.problems import Sphere @@ -51,7 +51,7 @@ def test_pva_error(self): sm.set_training_values(xe, ye) sm.train() - pva = compute_pva_error(sm, xe, ye) + pva = compute_pva(sm, xe, ye) self.assertLess(pva, 0.7) def test_rmse_error(self): @@ -60,7 +60,7 @@ def test_rmse_error(self): sm.set_training_values(xe, ye) sm.train() - rmse = compute_rmse_error(sm, xe, ye) + rmse = compute_rmse(sm, xe, ye) self.assertLess(rmse, 0.1) def test_q2_error(self): @@ -69,7 +69,7 @@ def test_q2_error(self): sm.set_training_values(xe, ye) sm.train() - q2 = compute_q2_error(sm, xe, ye) + q2 = compute_q2(sm, xe, ye) self.assertAlmostEqual(q2, 1.0, delta=1e-3)