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

Some bugs appear in demp_plot_2D #1

Open
Thunderabc opened this issue Jul 16, 2024 · 2 comments
Open

Some bugs appear in demp_plot_2D #1

Thunderabc opened this issue Jul 16, 2024 · 2 comments

Comments

@Thunderabc
Copy link

Good afternoon! When I'm working with this package, I'm getting an array mismatch error that seems to be due to a discrepancy between variables and their settings. How should I resolve this?
6abb4e2782cb1abe3ebfe34e67b62e2

@ntienvu
Copy link
Owner

ntienvu commented Jul 16, 2024

Hi,

Can you please provide more context on which line of code resulting in this bug ?

It is likely due to the different numpy version. Can you downgrade your numpy to be earlier version, such as numpy = 1.10.0

@Thunderabc
Copy link
Author

Thank you!More details about this bug:~\AppData\Local\Temp\ipykernel_10888\454163803.py in
1 print("initializing with 2 points - please wait...")
----> 2 boil.init(n_init_points=2)
3
4 print("done initialization")

~\Desktop\BOIL-master\bayes_opt\sequentialBO\boil.py in init(self, n_init_points, seed)
174
175 # Evaluate target function at all initialization
--> 176 y_init_curves, y_init_cost=self.f(init_X)
177
178 y_init_cost=np.atleast_2d(np.asarray(y_init_cost))#.astype('Float64')

~\Desktop\BOIL-master\bayes_opt\test_functions\drl_experiments.py in func(self, X)
55 elapse = [output[1]]
56 else:
---> 57 output = np.apply_along_axis(self.evaluate, 1, X)
58 Reward = output[:, 0].tolist()
59 elapse = output[:, 1].tolist()

<array_function internals> in apply_along_axis(*args, **kwargs)

D:\ANACONDA\envs\gpbss2\lib\site-packages\numpy\lib\shape_base.py in apply_along_axis(func1d, axis, arr, *args, **kwargs)
377 'Cannot apply_along_axis when any iteration dimensions are 0'
378 ) from None
--> 379 res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
380
381 # build a buffer for storing evaluations of func1d.

~\Desktop\BOIL-master\bayes_opt\test_functions\drl_experiments.py in evaluate(self, X, unwrap, display)
107
108 for e in range(N):
--> 109 totalrewards[e], t = ag.nextEpisode(env, t, display=display)
110 end_time = time.time()
111 elapse = end_time-start_time

~\Desktop\BOIL-master\bayes_opt\test_functions\drl\agents.py in nextEpisode(self, env, time, display)
84 for t in range(time, time + self.params["maxSteps"]):
85 action = self.act(observation, t)
---> 86 prev_obs = observation
87 if time_mod.time() - last_step < 0.01: # to avoid Mujoco error
88 time_mod.sleep(0.01)

~\Desktop\BOIL-master\bayes_opt\test_functions\drl\agents.py in act(self, state, time)
59 def act(self, state, time):
60 action = self._act(self.norm_state(np.atleast_2d(state)), time)
---> 61 return self.denorm_act(action)
62
63 def _act(self, state, time):

~\Desktop\BOIL-master\bayes_opt\test_functions\drl\agents.py in (s)
37 self.norm_state = (lambda s:
38 (np.reshape(s, (1, *state_space.shape)) - self.state_scale[0]) / self.state_scale[1])
---> 39 self.state_ph = tf.placeholder(tf.float32, shape=(None, *self.in_shape), name='obs')
40
41 if isinstance(action_space, gym.spaces.Discrete):
And Could you please provide the python-verision you used in this package? I tried 3.8/3.7, it seems none of them are compatible

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