Skip to content

In gp.py, predict() returns incorrectly-sized array, causing IndexError exception in ei_merit(). #48

@sjohnson-FLL

Description

@sjohnson-FLL

In gp.py, the predict() method returns an array of size (num_pts,). This does not match the returned size of the predict_std() method, which instead returns an array of size (num_pts,1).

This causes issues in ei_merit.py, in the ei_merit() function. When mu and sig are assigned different sizes on line 23, gamma (and subsequently beta then ei) will become a square array of size (num_pts, num_pts). This causes an IndexError exception on line 31, when the incorrectly-sized ei is indexed by the correctly-sized dmerit.

Potential solution:
In gp.py, in the predict() method, change line 71 to more closely match the form of line 85. Suggestion below:
return self._mu + self._sigma * np.expand_dims(self.model.predict(xx), axis=1)

Note: this issue appeared suddenly for me, without any updates to pySot itself, so it is possible that either:

  1. I introduced this issue by passing in bad values somewhere. However, the proposed fix resolved my issue, so I would say it's not likely that that is the problem.
  2. While I did not track the timing closely, there is a chance that this issue began to occur after upgrading from python 3.7 from 3.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions