diff --git a/smt/applications/tests/test_mixed_integer.py b/smt/applications/tests/test_mixed_integer.py index c38900e66..884a109d4 100644 --- a/smt/applications/tests/test_mixed_integer.py +++ b/smt/applications/tests/test_mixed_integer.py @@ -1040,9 +1040,9 @@ def test_hierarchical_design_space_example_all_categorical_decreed(self): for mixint_kernel in [ MixIntKernelType.CONT_RELAX, MixIntKernelType.GOWER, - # MixIntKernelType.COMPOUND_SYMMETRY, - # MixIntKernelType.EXP_HOMO_HSPHERE, - # MixIntKernelType.HOMO_HSPHERE, + # MixIntKernelType.COMPOUND_SYMMETRY, + # MixIntKernelType.EXP_HOMO_HSPHERE, + # MixIntKernelType.HOMO_HSPHERE, ]: sm = MixedIntegerKrigingModel( surrogate=KRG( @@ -1059,7 +1059,7 @@ def test_hierarchical_design_space_example_all_categorical_decreed(self): sm.train() y_s = sm.predict_values(Xt)[:, 0] _pred_RMSE = np.linalg.norm(y_s - Yt) / len(Yt) - self.assertLess(_pred_RMSE, 1e-4) + self.assertLess(_pred_RMSE, 1e-6) y_sv = sm.predict_variances(Xt)[:, 0] _var_RMSE = np.linalg.norm(y_sv) / len(Yt) self.assertLess(_var_RMSE, 1e-6) diff --git a/smt/surrogate_models/krg_based.py b/smt/surrogate_models/krg_based.py index f96a0d259..cf56906bd 100644 --- a/smt/surrogate_models/krg_based.py +++ b/smt/surrogate_models/krg_based.py @@ -986,7 +986,7 @@ def _reduced_likelihood_function(self, theta): X2 - self.X2_offset ) / self.X2_scale dx, _ = cross_distances(self.X2_norma[str(self._lvl)]) - + try: r = self._matrix_data_corr( corr=self.options["corr"], @@ -1001,7 +1001,7 @@ def _reduced_likelihood_function(self, theta): cat_kernel=self.options["categorical_kernel"], kplsk_second_loop=self.kplsk_second_loop, ).reshape(-1, 1) - + if np.isnan(r).any(): return reduced_likelihood_function_value, par except FloatingPointError: @@ -1590,7 +1590,7 @@ def _predict_init(self, x, is_acting): ) if np.any(self.design_space.is_conditionally_acting): dx[:, np.logical_not(self.unfolded_cat)] = ( - dnum / self.X2_scale[np.logical_not(self.unfolded_cat)] + dnum / self.X2_scale[np.logical_not(self.unfolded_cat)] ) Lij, _ = cross_levels( X=x, ij=ij, design_space=self.design_space, y=self.X_train diff --git a/smt/utils/kriging.py b/smt/utils/kriging.py index f4bba9892..ad2ce14db 100644 --- a/smt/utils/kriging.py +++ b/smt/utils/kriging.py @@ -302,8 +302,8 @@ def gower_componentwise_distances( Z_num = Z[:, ~cat_features] z_num_is_acting = z_is_acting[:, ~cat_features] num_is_decreed = is_decreed[~cat_features] - X_num_out = Z_num[x_index,] - Y_num_out = Z_num[y_index,] + Z_num[x_index,] + Z_num[y_index,] num_bounds = design_space.get_num_bounds()[~cat_features, :] if num_bounds.shape[0] > 0: Z_offset = num_bounds[:, 0] @@ -327,7 +327,7 @@ def gower_componentwise_distances( y, hierarchical_kernel, ) - D_num_out= D_num*Z_scale + D_num_out = D_num * Z_scale D = np.concatenate((D_cat, D_num), axis=1) * 0 D[:, np.logical_not(cat_features)] = D_num D[:, cat_features] = D_cat