Skip to content

Commit

Permalink
Merge pull request #205 from relf/master
Browse files Browse the repository at this point in the history
Fix MFKPLSK bug
  • Loading branch information
relf authored Jun 8, 2020
2 parents 635c20c + a59bad8 commit 9a9d341
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion smt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.2"
__version__ = "0.5.3"
4 changes: 4 additions & 0 deletions smt/applications/tests/test_mfkplsk.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def test_mfkplsk(self):
sm.options["xlimits"] = prob.xlimits
sm.options["print_global"] = False

# to test some options
sm.options["eval_noise"] = True
sm.options["optim_var"] = True

# modif MM
sm.options["n_comp"] = self.n_comp
sm.options["theta0"] = [1e-2] * self.n_comp
Expand Down
15 changes: 9 additions & 6 deletions smt/surrogate_models/krg_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,18 +519,21 @@ def minus_reduced_likelihood_function(log10t):
print("fmin_cobyla failed but the best value is retained")

if "KPLSK" in self.name:
if self.name == "MFKPLSK" and self.options["eval_noise"]:
# best_optimal_theta contains [theta, noise] if eval_noise = True
theta = best_optimal_theta[:-1]
else:
# best_optimal_theta contains [theta] if eval_noise = False
theta = best_optimal_theta

if exit_function:
return best_optimal_rlf_value, best_optimal_par, best_optimal_theta

if self.options["corr"] == "squar_exp":
self.options["theta0"] = (
best_optimal_theta * self.coeff_pls ** 2
).sum(1)
self.options["theta0"] = (theta * self.coeff_pls ** 2).sum(1)
else:
self.options["theta0"] = (
best_optimal_theta * np.abs(self.coeff_pls)
).sum(1)
self.options["theta0"] = (theta * np.abs(self.coeff_pls)).sum(1)

self.options["n_comp"] = int(self.nx)
limit = 10 * self.options["n_comp"]
self.best_iteration_fail = None
Expand Down

0 comments on commit 9a9d341

Please sign in to comment.