Comments (8)
Hi @Fa20, your code is missing definitions for setup_experiment()
and evaluate_parameters()
, so I had to guess a little. For me, it works. You may have gotten this error by running your code twice, in which case on
ax_client.complete_trial(trial_index=i, raw_data=result)
i
is a list index, say 0. But if there already were 20 trials on the experiment, you're trying to complete trial 0 when you should be trying to complete trial 20. Trial 0 is probably already completed, so this error being raised to save you from silent failures/bad results. You could either fix this by making sure the experiment is clean at the beginning, or by changing
ax_client.attach_trial(parameters=trial_params)
result = evaluate_parameters(trial_params)
ax_client.complete_trial(trial_index=i, raw_data=result)
to
params, trial_index = ax_client.attach_trial(parameters=trial_params)
result = evaluate_parameters(trial_params)
ax_client.complete_trial(trial_index= trial_index, raw_data=result)
like in the loop below. Probably you just want to make sure you start with a clean experiment though.
If this isn't it, please fix your minimal repro and I'll be happy to look again. Your minimal repro should include imports and all, with any private information substituted, so that I can copy and paste it into my own notebook and click run without any modification and see the error (or general problem) you're having.
from ax.
@danielcohenlive thanks for your answer.No I do not want clean and start from the beginning the problem that I need to evaluate the objective functions by simulation which need to keep the Ax code running till to get the result from the simulation and I thought that I can avoid this by stop run the code till the simulation is finished and attach the parmas . Is there in Ax better way to solve this problem in case that I do not want to keep the code running till get the result from Simulation?
from ax.
Is there in Ax better way to solve this problem in case that I do not want to keep the code running till get the result from Simulation?
@Fa20 could you clarify what you mean by not wanting to keep the code running... If you're talking about running a human in the loop experiment see https://ax.dev/tutorials/human_in_the_loop/human_in_the_loop.html. It's not written in AxClient though, so you'll have to cross reference with the service API tutorial.
from ax.
@danielcohenlive I mean when we run the Loop start the Generation step then evaluate the objective with this values of parameters. In my case I do not have this value of objective functions and I should calculate it Numerical which need some time and the Ax Code should wait till to get this value and then go to the next step .is there any way to that after the first Generation step that we can step excuted the code till the calculation of objective finished and then run it again but this time the step of evaluate the objective can be excuted
from ax.
@danielcohenlive I mean when we run the Loop start the Generation step then evaluate the objective with this values of parameters. In my case I do not have this value of objective functions and I should calculate it Numerical which need some time and the Ax Code should wait till to get this value and then go to the next step .is there any way to that after the first Generation step that we can step excuted the code till the calculation of objective finished and then run it again but this time the step of evaluate the objective can be excuted
Hi @Fa20, again drive-by commenting, but maybe you can:
- run the following (replace the num_trials by however much trials you need):
for i in range(num_trials):
parameterization, trial_index = ax_client.get_next_trial()
# extract parameters
p1 = parameterization["Polymer1"]
p2 = parameterization["Polymer2"]
# Save suggestions in the dictionary
experiment_suggestions[f"Iteration_{i}"] = {
'Polymer1': p1,
'Polymer2': p2,
}
- save your ax_client after finishing the loop (probably via
ax_client.save_to_json_file
; note this saves your ax_client instance, not the data) - do your simulations using data in the saved dictionary;
- reload your saved ax_client and do
ax_client.complete_trial()
, with the correct trial indices.
Probably you can also set up a scheduler, but I'm not sure how that works in Service.
from ax.
@Abrikosoff step 4
Do I need to use for loop
To evaluate the objectives and then complete the trial
from ax.
@Abrikosoff step 4 Do I need to use for loop To evaluate the objectives and then complete the trial
You probably would want to, although I think you can also partially complete the set of suggested trials. In that case if the remainder is larger than your max_parallelism
number (I think!) you won't be able to generate new trials.
from ax.
@Fa20 it looks like this issue can be closed. If you have further questions, please reopen it.
from ax.
Related Issues (20)
- MOO not respecting nonlinear constraints HOT 1
- Problem with Fixed parameters if nonlinear_inequality_constraint is imposed HOT 1
- Safe optimization in the Service API HOT 5
- The same point is evaluated multiple times during Integer Optimization with BO. HOT 5
- ax_client.generation_strategy.trials_as_df HOT 9
- Managing Objective Function Evaluation Failures in Ax for MOO HOT 6
- [GENERAL SUPPORT]: Managing Objective Function Evaluation Failures in Ax for MOO HOT 3
- [GENERAL SUPPORT]: Using qNegIntegratedPosteriorVariance HOT 3
- [GENERAL SUPPORT]: Reference point for multi-objective bayesian optimization HOT 4
- [GENERAL SUPPORT]: Adjusting search space or accommodating out-of-bounds initial data HOT 19
- [GENERAL SUPPORT]: Manual configuration, HOT 1
- [Bug]: Custom metric issue HOT 4
- [GENERAL SUPPORT]: CI_Level Paretofrontier
- [Bug]: Large sample time increase in ax-platform >= version 0.3.5 HOT 6
- [GENERAL SUPPORT]: Reference Point for Multi-Objective Bayesian Optimization HOT 5
- [GENERAL SUPPORT]: Plotting Pareto fronts / Posterior mean model HOT 6
- [GENERAL SUPPORT]: Getting best predicted point of a botorch model HOT 10
- [GENERAL SUPPORT]: Logical-or in outcome constraints HOT 4
- [GENERAL SUPPORT]: Parallelism and arbitrary parameter type support. HOT 5
- [GENERAL SUPPORT]: How to Standardize and Normalize Data for Service API HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ax.