question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get trained GP model from Service API for predictions and plotting

See original GitHub issue

hi,

i m trying to train a basic 1d GP on data from an excel sheet and then continue with .get_next_trial() (and plot after each iteration).

ax_client = AxClient()
ax_client.create_experiment(name=..., parameters=..., objective_name=..., minimize=True)

for _, row in df.iterrows():
    # format parameters and result
    p, trial_index = ax_client.attach_trial(parameters)
    ax_client.complete_trial(trial_index=trial_index, raw_data=result)

However, prediction and plotting is not possible, as ax_client.get_best_parameters() is giving ax.service.utils.best_point: Could not use model predictions to identify best point, will use raw objective values. and feeding ax_client.generation_strategy.model into render(...) gives NotImplementedError: RandomModelBridge does not support prediction.

A look at ax_client.generation_strategy.model shows None.

I can set up a model via model = get_GPEI(ax_client.experiment, ax_client.experiment.lookup_data()), which then can be plotted (and shows correct data).

How can I run the service api on a pre-trained GP and from there do standard bayesian optimization with model update?

best regards

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lena-kashtelyancommented, Oct 8, 2021

So ax_client.generation_strategy.model gets set after the first call to ax_client.get_next_trial(). If you reverse the order of operations to the following, your example should work:

print('next:', ax_client.get_next_trial())
print('model:', ax_client.generation_strategy.model)
print('best:', ax_client.get_best_parameters())

model = ax_client.generation_strategy.model
render(plot_slice(model, 'x', 'y'))
1reaction
btcorgtfocommented, Oct 9, 2021

hi!

thanks a lot for the A+ clarification. The changed order now has the hoped for / expected behaviour 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get predictions from a custom trained model | Vertex AI
This page shows you how to get online (real-time) predictions and batch predictions from your custom trained models using the Google Cloud console...
Read more >
Fitting Gaussian Process Models in Python - Domino Data Lab
We can then go back and generate predictions from the posterior GP, and plot several of them to get an idea of the...
Read more >
Basic (Gaussian likelihood) GP regression model
Optimise the model parameters​​ To obtain meaningful predictions, you need to tune the model parameters (that is, the parameters of the kernel, the...
Read more >
Implement A Gaussian Process From Scratch | by Shuai Guo
Subsequently, we can make predictions at unseen sites with the trained GP model and estimate the associated prediction uncertainty.
Read more >
Gaussian Process Regression in TensorFlow Probability
Here we generate training data from a noisy sinusoid, then sample a bunch of curves from the posterior of the GP regression model....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found