Closed lichengyuan98 closed 6 months ago
Hi @lichengyuan98, please provide the (1) python version, (2) pyrfr version, (3) OS platform you are using. Thanks.
(1) python=3.10.13 (2) pyrfr=0.9.0 (3) Windows 11 professional
Thanks!
I'm not sure which part is broken. We test on py=3.10.13/pyrfr=0.9.0 and both windows 10/11, and everything is fine. Would you please try the following steps?
surrogate_type='prf'
instead of 'gp' or 'auto'. This will enable the model (prf) used in parameter importance analysis for optimization. See if the optimization can run normally.swig -version
. I suggest using SWIG 3.0.12. Please try re-installing SWIG 3.0 (https://open-box.readthedocs.io/en/latest/installation/install_swig.html) and then re-installing pyrfr.history.get_importance(method='shap')
After trying history.get_importance(method='shap')
, everything is fine.
Thanks a lot!
space = sp.Space() x1 = sp.Real("x1", -5, 10, default_value=0) x2 = sp.Real("x2", 0, 15, default_value=0) space.add_variables([x1, x2])
Define Objective Function
def branin(config): x1, x2 = config['x1'], config['x2'] y = (x2-5.1/(4*np.pi2)*x1*2+5/np.pix1-6)2+10(1-1/(8np.pi))*np.cos(x1)+10 return {'objectives': [y]}
Run
opt = Optimizer( branin, space, max_runs=50, surrogate_type='gp', task_id='quick_start',) history = opt.run()
show the final results
print(history.get_importance())
How to solve this issue? Thanks!