Skip to content
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

Relevance of the warning R is too ill conditioned... #585

Closed
relf opened this issue Jun 14, 2024 · 3 comments · Fixed by #605
Closed

Relevance of the warning R is too ill conditioned... #585

relf opened this issue Jun 14, 2024 · 3 comments · Fixed by #605

Comments

@relf
Copy link
Member

relf commented Jun 14, 2024

When running the first example of kriging in the tutorial (reproduced here)

from smt.utils.misc import compute_rms_error
from smt.problems import Rosenbrock
from smt.sampling_methods import LHS
from smt.surrogate_models import KRG

ndim = 2
ndoe = 20  # int(10*ndim)
# Define the function
fun = Rosenbrock(ndim=ndim)

# Construction of the DOE
# in order to have the always same LHS points, random_state=1
sampling = LHS(xlimits=fun.xlimits, criterion="ese", random_state=1)
xt = sampling(ndoe)
# Compute the outputs
yt = fun(xt)

# Construction of the validation points
ntest = 200  # 500
sampling = LHS(xlimits=fun.xlimits, criterion="ese", random_state=1)
xtest = sampling(ntest)
ytest = fun(xtest)

# The variable 'theta0' is a list of length ndim.
t = KRG(theta0=[1e-2] * ndim, print_prediction=False)
t.set_training_values(xt, yt[:, 0])

t.train()

# Prediction of the validation points
y = t.predict_values(xtest)
print("Kriging,  err: " + str(compute_rms_error(t, xtest, ytest)))

I get the following output

python test_warning.py
___________________________________________________________________________

                                  Kriging
___________________________________________________________________________

 Problem size

      # training points.        : 20

___________________________________________________________________________

 Training

   Training ...
D:\rlafage\workspace\smt\smt\surrogate_models\krg_based.py:968: UserWarning: R is too ill conditioned. Poor combination of regression model and observations.
  warnings.warn(
   Training - done. Time (sec):  7.4901881
Kriging,  err: 0.00010937725926990396

While the error is pretty small we have this warning telling us something is wrong which is a pretty confusing.

@Paul-Saves
Copy link
Contributor

Paul-Saves commented Jun 14, 2024

Yes, I should have been more restrictive on this test. I will update it soon, sorry for the inconvenience.

@Paul-Saves
Copy link
Contributor

t.check_training_numerically() :

Minimal distance between two points in any direction is 5.84e-04
Correlation matrix R condition number is 3.07e+13
None

@Paul-Saves
Copy link
Contributor

With pow_exp: Minimal distance between two points in any direction is 8.48e-04
Correlation matrix R condition number is 8.48e+02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants