From b718315006583475b70bb765e0a408201b9e2e97 Mon Sep 17 00:00:00 2001 From: Dimitris Tsapetis Date: Mon, 20 Nov 2023 11:09:00 -0500 Subject: [PATCH] Sonarcloud bugfix --- .../surrogates/gaussian_process/GaussianProcessRegression.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UQpy/surrogates/gaussian_process/GaussianProcessRegression.py b/src/UQpy/surrogates/gaussian_process/GaussianProcessRegression.py index 41c114ae..9598c4ed 100755 --- a/src/UQpy/surrogates/gaussian_process/GaussianProcessRegression.py +++ b/src/UQpy/surrogates/gaussian_process/GaussianProcessRegression.py @@ -267,7 +267,10 @@ def predict(self, points, return_std: bool = False, hyperparameters: list = None if hyperparameters is not None: # This is used for MLE constraints, if constraints call 'predict' method. self.kernel.kernel_parameter = kernelparameters[:-1] - sigma = kernelparameters[-1] + if kernelparameters is not None: + sigma = kernelparameters[-1] + else: + raise ValueError('kernelparameters is None') K = sigma ** 2 * self.kernel.calculate_kernel_matrix(x=s_, s=s_) + \ np.eye(self.samples.shape[0]) * (noise_std ** 2) cc = np.linalg.cholesky(K + 1e-10 * np.eye(self.samples.shape[0]))