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

[WIP] Attempt to make optimas generators compatible with generator standard #249

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fbd8b0a
Rename tell to tell_trials
RemiLehe Jul 10, 2024
2fc7992
Rename _tell to tell
RemiLehe Jul 10, 2024
db6e2bc
Rename ask to ask_trials
RemiLehe Jul 10, 2024
522dd9c
Rename _ask to ask
RemiLehe Jul 10, 2024
2445546
Convert ask to new format for simple generators
RemiLehe Jul 10, 2024
0487226
Convert to tell format for simple generators
RemiLehe Jul 10, 2024
55400dd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 10, 2024
a879df1
Merge branch 'main' into standardization
RemiLehe Sep 20, 2024
cee853e
Fix bug
RemiLehe Sep 20, 2024
b29c7b5
Fix another bug
RemiLehe Sep 20, 2024
cb7a90e
Merge branch 'main' into standardization
RemiLehe Sep 24, 2024
d361865
Use new to_dict method
RemiLehe Sep 24, 2024
2a8053e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 24, 2024
db32626
Update the ask method of the Ax service API
RemiLehe Sep 24, 2024
687fe52
Merge branch 'standardization' of github.com:RemiLehe/optimas into st…
RemiLehe Sep 24, 2024
c233aa9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 24, 2024
38438bf
Add new `from_dict` method
RemiLehe Sep 24, 2024
d33ccb0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 24, 2024
cd01075
Fix bug when trials have failed
RemiLehe Sep 25, 2024
e1022a3
Update optimas/core/trial.py
RemiLehe Sep 25, 2024
2d72c63
Merge branch 'main' into standardization
RemiLehe Oct 21, 2024
6a3d111
Merge branch 'standardization' of github.com:RemiLehe/optimas into st…
RemiLehe Oct 21, 2024
e7e1d5b
Add function `custom_parameters_as_dict`
RemiLehe Oct 21, 2024
7cfa798
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2024
f66c716
Add function `custom_parameters_as_dict`
RemiLehe Oct 21, 2024
3668aaf
Merge branch 'standardization' of github.com:RemiLehe/optimas into st…
RemiLehe Oct 21, 2024
4dc2a95
Pass dicts to tell for Ax generator
RemiLehe Oct 21, 2024
3494360
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2024
ac7c618
Better handling of objectives and analyzed parameters
RemiLehe Oct 21, 2024
318d7f0
Update initialization of trials
RemiLehe Oct 21, 2024
4fc1f49
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2024
695cb5a
Merge branch 'standardization' of github.com:RemiLehe/optimas into st…
RemiLehe Oct 21, 2024
d1f11ff
Declare ax_trail_id as custom parameter for Ax generators
RemiLehe Oct 21, 2024
682f7d1
Merge branch 'declare_custom_parameter' into standardization
RemiLehe Oct 21, 2024
f5045cd
Merge branch 'standardization' of github.com:RemiLehe/optimas into st…
RemiLehe Oct 21, 2024
8df32a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2024
fb4bfbc
Handle custom parameters properly
RemiLehe Oct 21, 2024
31fa71b
Fix bug with order of coordinates
RemiLehe Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use new to_dict method
RemiLehe committed Sep 24, 2024
commit d361865d8f9cd66014182aad05aabd74059aca17
15 changes: 15 additions & 0 deletions optimas/core/trial.py
Original file line number Diff line number Diff line change
@@ -81,6 +81,21 @@ def __init__(
self._mapped_evaluations[ev.parameter.name] = ev
self.mark_as(TrialStatus.CANDIDATE)


def to_dict(self) -> Dict:
"""Convert the trial to a dictionary."""
trial_dict = {
**self.parameters_as_dict(),
**self.objectives_as_dict(),
**self.analyzed_parameters_as_dict(),
"_id": self._index,
"_ignored": self._ignored,
"_ignored_reason": self._ignored_reason,
"_status": self._status,
}
return trial_dict


@property
def varying_parameters(self) -> List[VaryingParameter]:
"""Get the list of varying parameters."""
11 changes: 1 addition & 10 deletions optimas/generators/base.py
Original file line number Diff line number Diff line change
@@ -254,16 +254,7 @@ def tell_trials(

"""
# Feed data to the generator, using the standardized API
results = []
for trial in trials:
# Convert to dictionaries
point = {
**trial.parameters_as_dict(),
**trial.analyzed_parameters_as_dict(),
**trial.objectives_as_dict(),
}
results.append(point)
self.tell(results)
self.tell( [ trial.to_dict() for trial in trials ] )

# Perform additional checks that rely on the trial format
for trial in trials: