Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Saves committed Apr 17, 2024
1 parent dc62a0d commit 201eff7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions smt/surrogate_models/krg_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ def _predict_values(self, x: np.ndarray, is_acting=None) -> np.ndarray:
if not (self.is_continuous):
if is_acting is None:
x, is_acting = self.design_space.correct_get_acting(x)
n_eval, n_features_x = x.shape
n_eval, _ = x.shape
_, ij = cross_distances(x, self.X_train)
dx = gower_componentwise_distances(
x,
Expand Down Expand Up @@ -1463,8 +1463,7 @@ def _predict_values(self, x: np.ndarray, is_acting=None) -> np.ndarray:
X_cont = (X_cont - self.X_offset) / self.X_scale

else:
n_eval, n_features_x = x.shape
_, ij = cross_distances(x, self.X_train)
n_eval, _ = x.shape
X_cont = (x - self.X_offset) / self.X_scale
# Get pairwise componentwise L1-distances to the input training set
dx = differences(X_cont, Y=self.X_norma.copy())
Expand Down Expand Up @@ -1499,7 +1498,7 @@ def _predict_derivatives(self, x, kx):
Derivative values.
"""
# Initialization
n_eval, n_features_x = x.shape
n_eval, _ = x.shape

x = (x - self.X_offset) / self.X_scale
# Get pairwise componentwise L1-distances to the input training set
Expand Down Expand Up @@ -1588,7 +1587,7 @@ def _predict_variances(self, x: np.ndarray, is_acting=None) -> np.ndarray:
if not (self.is_continuous):
if is_acting is None:
x, is_acting = self.design_space.correct_get_acting(x)
n_eval, n_features_x = x.shape
n_eval, _ = x.shape
X_cont = x
_, ij = cross_distances(x, self.X_train)
dx = gower_componentwise_distances(
Expand Down Expand Up @@ -1649,8 +1648,7 @@ def _predict_variances(self, x: np.ndarray, is_acting=None) -> np.ndarray:
X_cont, _ = compute_X_cont(x, self.design_space)
X_cont = (X_cont - self.X_offset) / self.X_scale
else:
n_eval, n_features_x = x.shape
_, ij = cross_distances(x, self.X_train)
n_eval, _ = x.shape
x = (x - self.X_offset) / self.X_scale
X_cont = np.copy(x)
# Get pairwise componentwise L1-distances to the input training set
Expand Down Expand Up @@ -1696,7 +1694,7 @@ def _predict_variance_derivatives(self, x, kx):
"""

# Initialization
n_eval, n_features_x = x.shape
n_eval, _ = x.shape
x = (x - self.X_offset) / self.X_scale
theta = self.optimal_theta
# Get pairwise componentwise L1-distances to the input training set
Expand Down

0 comments on commit 201eff7

Please sign in to comment.