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

ax_client.generation_strategy.trials_as_df #2569

Closed
Fa20 opened this issue Jul 6, 2024 · 9 comments
Closed

ax_client.generation_strategy.trials_as_df #2569

Fa20 opened this issue Jul 6, 2024 · 9 comments
Assignees
Labels
fixready Fix has landed on master.

Comments

@Fa20
Copy link

Fa20 commented Jul 6, 2024

Hallo Ax team,

I attached some trials but I can not display the attached trial as completed trial using :

ax_client.generation_strategy.trials_as_df

@mgarrard
Copy link
Contributor

mgarrard commented Jul 7, 2024

Hi Fa20, thanks for reaching out. In order for us to help you best it's useful to format questions with context on your goal/application, code that we can directly run on our side, and direct ptr to the issue vs the expected behavior. If you could provide that, that would be awesome. Thank you :)

@Fa20
Copy link
Author

Fa20 commented Jul 7, 2024

@mgarrard

from ax.service.ax_client import AxClient, ObjectiveProperties
from ax.utils.measurement.synthetic_functions import hartmann6
from ax.utils.notebook.plotting import init_notebook_plotting, render

init_notebook_plotting()
ax_client = AxClient()
ax_client.create_experiment(
    name="hartmann_test_experiment",
    parameters=[
        {
            "name": "x1",
            "type": "range",
            "bounds": [0.0, 1.0],
            "value_type": "float",  # Optional, defaults to inference from type of "bounds".
            "log_scale": False,  # Optional, defaults to False.
        },
        {
            "name": "x2",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
        {
            "name": "x3",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
        {
            "name": "x4",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
        {
            "name": "x5",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
        {
            "name": "x6",
            "type": "range",
            "bounds": [0.0, 1.0],
        },
    ],
    objectives={"hartmann6": ObjectiveProperties(minimize=True)},
    parameter_constraints=["x1 + x2 <= 2.0"],  # Optional.
    outcome_constraints=["l2norm <= 1.25"],  # Optional.
)

import numpy as np


def evaluate(parameterization):
    x = np.array([parameterization.get(f"x{i+1}") for i in range(6)])
    # In our case, standard error is 0, since we are computing a synthetic function.
    return {"hartmann6": (hartmann6(x), 0.0), "l2norm": (np.sqrt((x**2).sum()), 0.0)}

para,index=ax_client.attach_trial(
    parameters={"x1": 0.9, "x2": 0.9, "x3": 0.9, "x4": 0.9, "x5": 0.9, "x6": 0.9}
)
ax_client.complete_trial(trial_index=index, raw_data=evaluate(para))
ax_client.generation_strategy.trials_as_df > >```

@mgarrard
Copy link
Contributor

mgarrard commented Jul 8, 2024

Hi @Fa20 - could you provide a snippet of what logs etc you get from running ```ax_client.generation_strategy.trials_as_df`` ?

@Fa20
Copy link
Author

Fa20 commented Jul 8, 2024

@mgarrard

grafik

@mgarrard
Copy link
Contributor

Hi @Fa20 after doing some digging, this is because the trial is manually created. I have put up a fix and will update this thread once the fix lands on master

@mgarrard mgarrard added fixready Fix has landed on master. and removed in progress labels Jul 16, 2024
@mgarrard
Copy link
Contributor

@Fa20 fix has landed on main in #2577 , we are planning to do an ax release later this week and this will be on the most update to date version of Ax. Will close the task once we cut the release

@Abrikosoff
Copy link

@Fa20 fix has landed on main in #2577 , we are planning to do an ax release later this week and this will be on the most update to date version of Ax. Will close the task once we cut the release

Hi Mia @mgarrard , excited to hear about the new Ax release! Would you be able to give a glimpse of a few of the major changes, if any?

@mgarrard
Copy link
Contributor

Hey @Abrikosoff, this will be a general maintence release, and all the updates will be summarized in the release post -- I'm actually going to cut it Monday because we're close to the weekend now. Will link it here for you when it's done. As far as major upgrades, we are planning a bigger release end of year/ early next year to expose some more advanced methods and improve the usability of our framework :)

@mgarrard
Copy link
Contributor

Closing the issue as the release just went out that includes the fix: https://github.com/facebook/Ax/releases/tag/0.4.1 cc @Fa20 and @Abrikosoff (release notes have all updates)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixready Fix has landed on master.
Projects
None yet
Development

No branches or pull requests

3 participants