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

Question About KeyError: 'design_space' #601

Closed
ilaudo opened this issue Jun 25, 2024 · 1 comment
Closed

Question About KeyError: 'design_space' #601

ilaudo opened this issue Jun 25, 2024 · 1 comment

Comments

@ilaudo
Copy link

ilaudo commented Jun 25, 2024

Hello there, I am trying to implement the KRG() function into an optimal control problem using Dymos. I have trained my Kriging models on a large set of data which requires three inputs and one output. However, each time that I try to call the .predict_values() method in my optimal control code, I receive a KeyError: 'design_space'. My guess thusfar is that the kriging models do not believe they have been trained on continuous data, however, I am unsure. It should be noted that I have my Kriging models saved in .pickle files to prevent them from being retrained each iteration. This code worked perfectly fine up until one day ago, in which it started acting rather odd. I appreciate the help!
Here is the function call I use: CL = smt.predict_values(inputValues) where inputValues has a dimension of (nn, 3) and CL has a dimension of (nn, 1).

Here is the full error printout:
Traceback (most recent call last):

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/openmdao/core/system.py:2666 in _call_user_function
    yield

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/openmdao/core/explicitcomponent.py:267 in _compute_wrapper
    self.compute(self._inputs, self._outputs)

  File ~/Documents/HypersonicMDA-main/ClimbTraj.py:126 in compute
    CL = sml.predict_values(inputValues)

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/smt/surrogate_models/krg_based.py:1433 in predict_values
    y = self._predict_values(x2, is_acting=is_acting)

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/smt/surrogate_models/krg_based.py:1457 in _predict_values
    if not (self.is_continuous):

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/smt/surrogate_models/krg_based.py:260 in is_continuous
    return self.design_space.is_all_cont

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/smt/surrogate_models/krg_based.py:246 in design_space
    if self.options["design_space"] is None:

  File ~/anaconda3/envs/StratoLaunchProject/lib/python3.10/site-packages/smt/utils/options_dictionary.py:52 in __getitem__
    return self._dict[name]

KeyError: 'design_space'
@relf relf mentioned this issue Jun 26, 2024
@relf
Copy link
Member

relf commented Jun 26, 2024

Did you change the SMT version? What version do you use? Looks like your pickle files were generated with an old version without the design_space property which was added in release 2.0. Either you retrain your models and save the pickle files with your current version (2.x?) of SMT or you downgrade to the version (1.3?) you used to generate the pickles.

@relf relf closed this as completed Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants