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

Error converting shapes due to mismatched size of X and s2 #53

Open
noraharhen opened this issue Apr 9, 2024 · 2 comments
Open

Error converting shapes due to mismatched size of X and s2 #53

noraharhen opened this issue Apr 9, 2024 · 2 comments

Comments

@noraharhen
Copy link

I'm getting this crazy error occasionally while running pybads with specify_target_noise=true. It looks like somehow s2 ends up with more elements than rows of X. Any idea what could be going on here?

Unfortunately, I cant create a reprex—it only happens occasionally with my own model fitting code...

Traceback (most recent call last):
  File "/dfs6/pub/nharhen/foraging/model_fitting/experiment1k_kids/cross_val/bads.py", line 39, in <module>
    result = bads.optimize()
  File "/data/homezvol3/nharhen/.local/lib/python3.9/site-packages/pybads/bads/bads.py", line 1239, in optimize
    ) = self._search_step_(gp)
  File "/data/homezvol3/nharhen/.local/lib/python3.9/site-packages/pybads/bads/bads.py", line 1554, in _search_step_
    gp, gp_exit_flag = local_gp_fitting(
  File "/data/homezvol3/nharhen/.local/lib/python3.9/site-packages/pybads/bads/gaussian_process_train.py", line 402, in local_gp_fitting
    gp, hyp_gp, res, exit_flag = _robust_gp_fit_(
  File "/data/homezvol3/nharhen/.local/lib/python3.9/site-packages/pybads/bads/gaussian_process_train.py", line 542, in _robust_gp_fit_
    new_hyp, _, res = tmp_gp.fit(
  File "/data/homezvol3/nharhen/.local/lib/python3.9/site-packages/gpyreg/gaussian_process.py", line 1008, in fit
    X, y, s2 = self._convert_shapes(X, y, s2)
  File "/data/homezvol3/nharhen/.local/lib/python3.9/site-packages/gpyreg/gaussian_process.py", line 2555, in _convert_shapes
    s2 = s2.reshape(N, 1)
ValueError: cannot reshape array of size 55 into shape (51,1)
@lacerbi
Copy link
Contributor

lacerbi commented Apr 16, 2024

Thanks for the report! This seems tough to debug if it happens randomly.
@GurjeetSinghSangra is looking into it but this might take a while.

@GurjeetSinghSangra
Copy link
Collaborator

GurjeetSinghSangra commented Apr 25, 2024

Hello @noraharhen,
apologies for the late response, and thanks for reporting this.

I have been investigating this report. Unfortunately, by running Pybads on specified noisy tasks (specify_target_noise=true), I haven't been able to reproduce your problem, even for a high number of function evaluations (i.e. longer optimization runs) or high-dimension settings.

Moreover, by inspecting the most possible/likely parts of the code that should relate to your stack trace and related parts of the code. I do not find anything suspicious that could raise any errors or bugs.

I require a reproducible experiment to facilitate better debugging. The configuration setting should include your setting, which includes your function, prior bounds, and hopefully your random seed number.

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

3 participants