Skip to content

Comments in ei_merit() do not match the actual sizes of parameters passed to the function #47

@sjohnson-FLL

Description

@sjohnson-FLL

In ei_merit.py, in the ei_merit() method, the sizes of the parameters passed do not match the comments.

My setup:

  • 6 dimensional optimization problem (all dimensions are continuous)
  • EIStrategy
  • SymmetricLatinHypercube (num_pts = 2*dim + 1)
  • PolyRegressor

To reproduce: put a breakpoint on line 23 in ei_merit() and use the debug console to observe the following:

np.shape(X)
(100, 6)
np.shape(fX)
(6, 1)
np.shape(XX)
(18, 6)

Two semi-separate issues:

  1. The comment on line 15 states that parameter XX should have shape m x 1. It should actually by m x dim since XX represents inputs to the objective function, which have size equal to the dimension of the problem.
    I think this should be an easy fix, assuming that I diagnosed the issue correctly.

  2. The comments on lines 13 and 15 collectively state that the dimensions on axis 0 of fX and XX should match (and be equal to m). While this would make sense to me, I have not observed that in practice (see console output above). I believe this discrepancy can be traced back to line 33 of ei_ga.py, where the pending evaluations are appended to the previously evaluated points before later passing them to ei_merit on line 41. This makes the array of previously evaluated points larger than the array of values at previously evaluated points, by an amount equal to the number of pending evaluations.
    I am not sure if I correctly diagnosed the root cause of this issue. While the comment is definitely wrong in the current state, I do not know whether the comment or the code meets the intent of the design. As far as I can tell, the code in its current state does not cause any problems with effectiveness or reliability.

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