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

how to get plots(slice, contour) from 'ax_client_snapshot.json'? #2064

Open
rachelhson opened this issue Dec 8, 2023 · 3 comments
Open

how to get plots(slice, contour) from 'ax_client_snapshot.json'? #2064

rachelhson opened this issue Dec 8, 2023 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@rachelhson
Copy link

Hello,

I am trying to plot plot_slice, contour using saved ax_client_snapshot.json.
Could you help me to have plots from ax_client_snapshot.json?
I used following code for the plots, however I am getting AttributeError. Is there a way to get these plots from restored_ax_client?

restored_ax_client = ( AxClient.load_from_json_file() ) model = restored_ax_client.generation_strategy.model render(plot_slice(model, param1_name, objective)) render(interact_contour(model=model, metric_name=objective))
image

Thank you :)

@rachelhson rachelhson changed the title how to pull out the saved model from 'ax_client_snapshot.json'? how to get plots(slice, contour) from 'ax_client_snapshot.json'? Dec 8, 2023
@danielcohenlive
Copy link

@rachelhson the basic problem is that we don't serialize fitted models. So instead of

model = restored_ax_client.generation_strategy.model

you would need to do

model = restored_ax_client.generation_strategy._curr.model(
    experiment=restored_ax_client.experiment,
    data=restored_ax_client.experiment.lookup_data(),
    **restored_ax_client.generation_strategy._curr.model_kwargs
)

After you call restored_ax_client.get_next_trial() though, you can go back to the original way of doing it.

@danielcohenlive danielcohenlive added the question Further information is requested label Dec 11, 2023
@danielcohenlive danielcohenlive self-assigned this Dec 11, 2023
@rachelhson
Copy link
Author

Thanks for your reply @danielcohenlive . This works for plotting slice model and contour.

If I use generation strategy for my model. Does it have to separately store and call to retrieve?

@danielcohenlive
Copy link

@rachelhson can you rephrase the question. I'm not sure what you mean by "call to retrieve". And store and call to retrieve during which operation. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants