Skip to content

Commit

Permalink
refining pybcs demo
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdebus committed Sep 9, 2023
1 parent 112c2bf commit b9c1006
Show file tree
Hide file tree
Showing 2 changed files with 3,350 additions and 744 deletions.
7 changes: 5 additions & 2 deletions PyUQTk/PyPCE/pce_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def UQTkBCS(pc_begin, xdata, ydata, eta=1.e-3, niter=1, mindex_growth=None, ntry
pc_model_final: PC object with basis expanded by the iterations
cfs_final: 1D Numpy array with PC coefficients for each term of the final
model [#terms_in_final_basis,]
sigma2: data noise variance, updated by bcs algorithm (if desired), scalar
"""

# Sends error message if y-values are multi-dimensional
Expand Down Expand Up @@ -561,12 +562,14 @@ def UQTkBCS(pc_begin, xdata, ydata, eta=1.e-3, niter=1, mindex_growth=None, ntry
print("Coefficients:")
print(cfs_final)
print(len(cfs_final), " terms retained out of a full basis of size", full_basis_size)
print("Reestimated sigma2:", sigma2)
print("Reestimated sigma2: %.3e"%sigma2)

if return_sigma2:
return pc_model_final, cfs_final, sigma2
else:
print("Please note that sigma2 will be returned by default in future versions.")
print("\nPlease note that sigma2 will be returned by default in future versions.")
print("To remain compatible, set input argument return_sigma2 to True and expect")
print("three return arguments: pc_model, coefficients, updated noise variance\n")
return pc_model_final, cfs_final
################################################################################
def UQTkOptimizeEta(pc_start, y, x, etas, niter, nfolds, mindex_growth, verbose, plot=False):
Expand Down
4,087 changes: 3,345 additions & 742 deletions examples/surrogate_genz/surrogate_genz-BCS_detailed.ipynb

Large diffs are not rendered by default.

0 comments on commit b9c1006

Please sign in to comment.