-
Couldn't load subscription status.
- Fork 0
24 add example gallery to sphinx docs #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| # Testing data | ||
| n_tst = 10000 | ||
| x_tst = rng.random(n=n_tst) # random numbers in [0,1]^d | ||
| y_tst = func(x_tst) + np.random.normal(0, noise_std, size = (n_tst,1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding noise to the test data? I think we should only add noise to the training data, not the testing data.
|
|
||
| # Training data | ||
| np.random.seed(42) | ||
| n_trn = 70 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to explain the choice of 70 training points. As BCS is a sparse regression approach, it is designed for the situation where we do not have enough data to fit all basis terms without using regularization.
| print("Number of Basis Terms:", len(pce_surr.pcrv.mindices[0])) | ||
|
|
||
| # (1.5) Set training data | ||
| pce_surr.set_training_data(x_trn, y_trn[:,0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data is still defined on [0,1]^d rather than [-1,1]^d. I thought you had reworked this to match the domain of the basis terms. Do I have that wrong?
| np.random.seed(42) | ||
| n_trn = 70 | ||
| x_trn = rng.random(n=n_trn) # random numbers in [0,1]^d | ||
| y_trn = func(x_trn) + np.random.normal(0, noise_std, size = (n_trn,1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does func return a 2-D array?
| y_trn_approx = pce_surr.evaluate(x_trn) | ||
| y_tst_approx = pce_surr.evaluate(x_tst) | ||
|
|
||
| # Evaluate goodness of fit with RMSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the computation of the RMSE errors below the parity plots. The parity plots already indicate that there is a lot of error in the testing data predictions, and the RMSE then confirms that.
|
Hi Bert,
I should have clarified that the example in that branch is the non-updated one. The branch with the updated example is not yet on GitHub (it’s for the issue regarding integrating the eta optimization function); I actually was hoping we could briefly look over the changes in the example notebook again today.
Best,
Emilie
From: Bert Debusschere ***@***.***>
Date: Friday, October 24, 2025 at 2:27 PM
To: sandialabs/pytuq ***@***.***>
Cc: Baillo, Emilie Grace Eduria ***@***.***>, Author ***@***.***>
Subject: [EXTERNAL] Re: [sandialabs/pytuq] 24 add example gallery to sphinx docs (PR #27)
@bjdebus commented on this pull request.
________________________________
In docs/auto_examples/ex_genz_bcs.py<#27 (comment)>:
+# After importing GenzOscillatory from ``pytuq.func.genz``, we generate the Genz function below, along with training data and testing data with output noise.
+# This data and the corresponding Genz function will be used to create the same PC surrogate fitted in both examples:
+# (1) The first surrogate will be fitted using BCS with a given eta, and (2) the second surrogate will be fitted using BCS with the most optimal eta.
+
+# Use Genz Oscillatory function in multiple dimensions for the true model
+func_dim = 4
+func_weights = [1.0/(i+1)**2 for i in range(func_dim)]
+func = GenzOscillatory(shift=0.25, weights=func_weights)
+noise_std = 0.1
+rng = qmc.LatinHypercube(d=func_dim, seed=rng_seed)
+
+# Training data
+np.random.seed(42)
+n_trn = 70
+x_trn = rng.random(n=n_trn) # random numbers in [0,1]^d
+y_trn = func(x_trn) + np.random.normal(0, noise_std, size = (n_trn,1))
Does func return a 2-D array?
—
Reply to this email directly, view it on GitHub<#27 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BOTIAVYAGUCPTGJ3HHBMKVD3ZKKTJAVCNFSM6AAAAACKEFVOKWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGNZYHA4TGOBVGI>.
You are receiving this because you authored the thread.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved, per our conversation.
Added sphinx-gallery to the docs