Skip to content

Commit

Permalink
Fix EGMDO generated code to work with SMT > 1.3.0 (#199)
Browse files Browse the repository at this point in the history
* Upgrade SMT 2.6.2+ : predict_variance_gradient API call

* Upgrade Python requirements

* Update smt, egobox in requirements.txt

* Fix predict_variance_gradient call with smt 2.6.2

* Fix stupid typo
  • Loading branch information
relf authored Jun 26, 2024
1 parent 4d3e645 commit af8738d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/lib/whats_opt/templates/egmdo/random_analysis.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class <%= disc.impl.py_classname %>RandomDiscipline(om.ExplicitComponent):
<%- disc.impl.numeric_output_vars.each do |v| -%>
i = 0
sigma = np.sqrt(self.gp_<%= v.py_varname %>.predict_variances(inputs_gp))
d_sigma = self.gp_<%= v.py_varname %>.predict_variance_derivatives(inputs_gp)/(2.0*sigma)
sigma += 1e-8 # to avoid division by zero if sigma is zero (1e-8 ~ sqrt(machine epsilon))
d_sigma = np.atleast_2d(self.gp_<%= v.py_varname %>.predict_variance_gradient(inputs_gp))/(2.0*sigma)
for name in sorted(inputs.keys()):
if name in random_inputs:
sigma = np.sqrt(self.gp_<%= v.py_varname %>.predict_variances(inputs_gp))
Expand Down
6 changes: 3 additions & 3 deletions services/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
numpy
numpy<2.0
pandas
scipy
cython
scikit-learn
wop
smt~=2.5.0
smt~=2.6.2
salib~=1.4.7
thrift~=0.20.0
openturns~=1.21.0
egobox~=0.16.0
egobox~=0.20.0

0 comments on commit af8738d

Please sign in to comment.