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

Issue when starting an AxClient with out-of-design points #2265

Closed
AngelFP opened this issue Mar 12, 2024 · 2 comments
Closed

Issue when starting an AxClient with out-of-design points #2265

AngelFP opened this issue Mar 12, 2024 · 2 comments
Assignees

Comments

@AngelFP
Copy link

AngelFP commented Mar 12, 2024

Hi all,

First of all thank you for the great library, we've been extensively using it for optimizing the performance of particle accelerators and it's been working really well.

We're currently using Ax within a higher level framework that, among other things, enables the user to update the search space. One use case for this is to resume an old optimization with a more narrowed-down parameter range.

To implement this, I've used the fit_out_of_design parameter to enable the model to use data outside of the updated range, as well as this workaround (#768 (comment)) to attach the old out-of-range data to the AxClient. However, I'm facing an issue where, despite using fit_out_of_design=True, the out-of-design data is being filtered out. This is the error I get:

ValueError: There are no feasible observed points.  This likely means that one or more outcome constraints or objective thresholds is set too strictly.

Below is a simple reproducer of this issue:

from ax import Arm
from ax.service.ax_client import AxClient, ObjectiveProperties
from ax.modelbridge.registry import Models
from ax.modelbridge.generation_strategy import (
    GenerationStep,
    GenerationStrategy,
)


ax_client = AxClient(
    generation_strategy=GenerationStrategy(
        steps=[
            GenerationStep(
                model=Models.GPEI,
                num_trials=-1,
                model_kwargs={"fit_out_of_design": True},
            )
        ]
    )
)


ax_client.create_experiment(
    name="test_experiment",
    parameters=[
        {
            "name": "x1",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
        {
            "name": "x2",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
    ],
    objectives={
        "f": ObjectiveProperties(minimize=True),
    },
)


# Add old trials outside of seach space
old_trial_data = [
    [{"x1": -1.0, "x2": 0.1}, {"f": 0.5}],
    [{"x1": -2.0, "x2": 0.2}, {"f": 0.1}],
    [{"x1": 3.0, "x2": 0.2}, {"f": 0.2}],
    [{"x1": 2.0, "x2": 0.4}, {"f": 0.8}],
]
for inputs, outcomes in old_trial_data:
    trial = ax_client.experiment.new_trial()
    trial.add_arm(Arm(parameters=inputs))
    trial.mark_running(no_runner_required=True)
    ax_client.complete_trial(trial_index=trial.index, raw_data=outcomes)


# Try to get next trial.
ax_client.get_next_trial()

I think the issue is in the filter_constraints_and_fixed_features function. In particular, if I comment out these two lines, everything seems to work well

for i, b in enumerate(bounds):

Is this the expected behavior or am I doing something wrong?

@AngelFP AngelFP changed the title Issue when starting an AxClient with out-of-design poins Issue when starting an AxClient with out-of-design points Mar 12, 2024
@Cesar-Cardoso Cesar-Cardoso self-assigned this Mar 13, 2024
Cesar-Cardoso added a commit to Cesar-Cardoso/Ax that referenced this issue Mar 14, 2024
Summary: See facebook#2265

Differential Revision: D54824195
Cesar-Cardoso added a commit to Cesar-Cardoso/Ax that referenced this issue Mar 15, 2024
Summary:

See facebook#2265

Reviewed By: esantorella

Differential Revision: D54824195
@Cesar-Cardoso
Copy link
Contributor

Hi Angel! It is not the expected behavior, and it should be fixed after #2277. Thanks for flagging this issue!

facebook-github-bot pushed a commit that referenced this issue Mar 15, 2024
Summary:
Pull Request resolved: #2277

See #2265

Reviewed By: esantorella

Differential Revision: D54824195

fbshipit-source-id: 69617af1f74c73175bc68e627b56e526d76090cd
@AngelFP
Copy link
Author

AngelFP commented Mar 15, 2024

Great to hear! Thanks for fixing this so quickly.

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

2 participants