Conversation
c65253b to
e9198d8
Compare
e9198d8 to
fac7ad2
Compare
ead2e64 to
9b3e191
Compare
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
|
This pull request has not seen any recent activity. |
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
optuna/_gp/search_space.py
Outdated
| self, | ||
| trials: list[FrozenTrial], | ||
| ) -> np.ndarray: | ||
| values = np.zeros((len(trials), len(self._optuna_search_space)), dtype=np.float64) |
There was a problem hiding this comment.
[nit] In Optuna, dtype=float is more conventional, but it is a nit picking.
https://numpy.org/doc/stable/user/basics.types.html
For a huge array, np.empty is better, but the size of this array would not be that huge for GPSampler probably.
| values = np.zeros((len(trials), len(self._optuna_search_space)), dtype=np.float64) | |
| values = np.empty((len(trials), len(self._optuna_search_space)), dtype=float) |
There was a problem hiding this comment.
Thank you for the suggestion. I was just following the original implementation in order to minimize the difference from the original one. However, I agree with the points you mentioned, and I wanted to update.
Since the same thing also holds for the contractor, I will also update it if we update here.
nabenabe0928
left a comment
There was a problem hiding this comment.
LGTM!
I left only minor comments:)
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
sawa3030
left a comment
There was a problem hiding this comment.
Apologies for the delay in reviewing. I’ve confirmed that _ScaleType is now only used in search_space.py, and the behavior remains consistent. LGTM!
Motivation
Note
This change is necessary to merge multi-objective constrained optimization in a clean manner.
Currently, in the
SearchSpaceused for GP, variables such asscale_types,bounds, andstepare being passed around in too many places. Furthermore,optuna/_gp/search_space.pymixes functions that operate on individual dimensions with those that handle the entire space. This makes it difficult to understand the code and maintain it.To address this, I refactor the code in
optuna/_gp/search_space.pyby turning the scattered functions into methods ofSearchSpace.Description of the changes
SearchSpace, making the code more organized and easier to maintain.Note
Since the search space itself and the sampled points within the space are conceptually distinct, I designed the implementation so that points are passed explicitly as arguments to methods, such as
get_normalized_paramsandget_unnormalized_params.Sanity check
I verified that the original master (
c44f263633ef01c08e44c8fbfdced85fb4131fb7) branch and this PR (58b31be40a5b3f72b02c2a85de05bfe0783306fc) produce exactly the same output using the following script: