Skip to content

Commit

Permalink
Eta optimization plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Caitlin Curry committed May 15, 2023
1 parent 9e768e3 commit c0369d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions PyUQTk/PyPCE/pce_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def UQTkRegression(pc_model,f_evaluations, samplepts):
################################################################################
def UQTkBCS(pc_model, xdata, ydata, niter, eta, ntry=5, eta_folds=5,\
mindex_growth='nonconservative', regparams=None, sigma2=1e-8, trval_frac=None,\
npccut=None, pcf_thr=None, verbose=0):
npccut=None, pcf_thr=None, verbose=0, eta_plot=False):
"""
Obtain PC coefficients by Bayesian compressive sensing
Expand Down Expand Up @@ -410,6 +410,7 @@ def UQTkBCS(pc_model, xdata, ydata, niter, eta, ntry=5, eta_folds=5,\
pcf_thr: Minimum value (magnitude) for PC coefficients, for pruning low PC coefficients 'by hand'
default is None
verbose: Flag for optional print statements
eta_plot Flag for saving a plot of etas vs. RMSE
Output:
pc_model_final: PC object with basis expanded by the iterations
Expand All @@ -429,7 +430,7 @@ def UQTkBCS(pc_model, xdata, ydata, niter, eta, ntry=5, eta_folds=5,\
RMSE_eta_tr=[]
elif (type(eta)==np.ndarray or type(eta)==list):
# the eta with the lowest RMSE is selected from etas
eta_opt = UQTkOptimizeEta(pc_model, ydata, xdata, eta, niter, eta_folds)
eta_opt = UQTkOptimizeEta(pc_model, ydata, xdata, eta, niter, eta_folds, eta_plot)
if verbose:
print("Optimal eta is", eta_opt)
else:
Expand Down
Loading

0 comments on commit c0369d7

Please sign in to comment.