Using external methods for candidate generation in Ax
Out of the box, Ax offers many options for candidate generation, most of which utilize
Bayesian optimization algorithms built using BoTorch. Users can
allow Ax to select which methods from BoTorch will be used for optimization
automatically (optionally guiding the choice by calling
configure_generation_strategy
) and can also
direct Ax to use specific BoTorch components directly via the
Modular Botorch framework. Users that want to leverage
Ax for experiment state management and orchestration via the Client
and other features
(e.g., early stopping, analyses, storage), while relying on other methods not
implemented in BoTorch for candidate generation can implement their own
ExternalGenerationNode
.
A GenerationNode
is a building block of a GenerationStrategy
. They can be combined
together utilize different methods for generating candidates at different stages of an
experiment. ExternalGenerationNode
exposes a lightweight interface to allow the users
to easily integrate their methods into Ax, and use them as standalone or with other
GenerationNode
s in a GenerationStrategy
.
In this tutorial, we will implement a simple generation node using
RandomForestRegressor
from sklearn, and combine it with Sobol (for initialization) to
optimize the Hartmann6 problem.
NOTE: This generation node using RandomForestRegressor
is a naive implementation and
for demonstration purposes only; it is not representative of how more sophisticated
random forest Bayesian optimization algorithms perform. We do not recommend using this
strategy as it typically does not perform well compared to Ax's default algorithms due
to its overly greedy behavior.
import time
from typing import Any
import numpy as np
from ax.adapter.registry import Generators
from ax.api.client import Client
from ax.api.configs import RangeParameterConfig
from ax.analysis.plotly.arm_effects import ArmEffectsPlot
from ax.analysis.summary import Summary
from ax.core.base_trial import TrialStatus
from ax.core.data import Data
from ax.core.experiment import Experiment
from ax.core.parameter import RangeParameter
from ax.core.types import TParameterization
from ax.generation_strategy.external_generation_node import ExternalGenerationNode
from ax.generation_strategy.generation_node import GenerationNode
from ax.generation_strategy.generation_strategy import GenerationStrategy
from ax.generation_strategy.generator_spec import GeneratorSpec
from ax.generation_strategy.transition_criterion import MaxTrials
from sklearn.ensemble import RandomForestRegressor
class RandomForestGenerationNode(ExternalGenerationNode):
"""A generation node that uses the RandomForestRegressor
from sklearn to predict candidate performance and picks the
next point as the random sample that has the best prediction.
To leverage external methods for candidate generation, the user must
create a subclass that implements ``update_generator_state`` and
``get_next_candidate`` methods. This can then be provided
as a node into a ``GenerationStrategy``, either as standalone or as
part of a larger generation strategy with other generation nodes,
e.g., with a Sobol node for initialization.
"""
def __init__(self, num_samples: int, regressor_options: dict[str, Any]) -> None:
"""Initialize the generation node.
Args:
regressor_options: Options to pass to the random forest regressor.
num_samples: Number of random samples from the search space
used during candidate generation. The sample with the best
prediction is recommended as the next candidate.
"""
t_init_start = time.monotonic()
super().__init__(node_name="RandomForest")
self.num_samples: int = num_samples
self.regressor: RandomForestRegressor = RandomForestRegressor(
**regressor_options
)
# We will set these later when updating the state.
# Alternatively, we could have required experiment as an input
# and extracted them here.
self.parameters: list[RangeParameter] | None = None
self.minimize: bool | None = None
# Recording time spent in initializing the generator. This is
# used to compute the time spent in candidate generation.
self.fit_time_since_gen: float = time.monotonic() - t_init_start
def update_generator_state(self, experiment: Experiment, data: Data) -> None:
"""A method used to update the state of the generator. This includes any
models, predictors or any other custom state used by the generation node.
This method will be called with the up-to-date experiment and data before
``get_next_candidate`` is called to generate the next trial(s). Note
that ``get_next_candidate`` may be called multiple times (to generate
multiple candidates) after a call to ``update_generator_state``.
For this example, we will train the regressor using the latest data from
the experiment.
Args:
experiment: The ``Experiment`` object representing the current state of the
experiment. The key properties includes ``trials``, ``search_space``,
and ``optimization_config``. The data is provided as a separate arg.
data: The data / metrics collected on the experiment so far.
"""
search_space = experiment.search_space
parameter_names = list(search_space.parameters.keys())
metric_names = list(experiment.optimization_config.metrics.keys())
if any(
not isinstance(p, RangeParameter) for p in search_space.parameters.values()
):
raise NotImplementedError(
"This example only supports RangeParameters in the search space."
)
if search_space.parameter_constraints:
raise NotImplementedError(
"This example does not support parameter constraints."
)
if len(metric_names) != 1:
raise NotImplementedError(
"This example only supports single-objective optimization."
)
# Get the data for the completed trials.
num_completed_trials = len(experiment.trials_by_status[TrialStatus.COMPLETED])
x = np.zeros([num_completed_trials, len(parameter_names)])
y = np.zeros([num_completed_trials, 1])
for t_idx, trial in experiment.trials.items():
if trial.status == "COMPLETED":
trial_parameters = trial.arm.parameters
x[t_idx, :] = np.array([trial_parameters[p] for p in parameter_names])
trial_df = data.df[data.df["trial_index"] == t_idx]
y[t_idx, 0] = trial_df[trial_df["metric_name"] == metric_names[0]][
"mean"
].item()
# Train the regressor.
self.regressor.fit(x, y)
# Update the attributes not set in __init__.
self.parameters = search_space.parameters
self.minimize = experiment.optimization_config.objective.minimize
def get_next_candidate(
self, pending_parameters: list[TParameterization]
) -> TParameterization:
"""Get the parameters for the next candidate configuration to evaluate.
We will draw ``self.num_samples`` random samples from the search space
and predict the objective value for each sample. We will then return
the sample with the best predicted value.
Args:
pending_parameters: A list of parameters of the candidates pending
evaluation. This is often used to avoid generating duplicate candidates.
We ignore this here for simplicity.
Returns:
A dictionary mapping parameter names to parameter values for the next
candidate suggested by the method.
"""
bounds = np.array([[p.lower, p.upper] for p in self.parameters.values()])
unit_samples = np.random.random_sample([self.num_samples, len(bounds)])
samples = bounds[:, 0] + (bounds[:, 1] - bounds[:, 0]) * unit_samples
# Predict the objective value for each sample.
y_pred = self.regressor.predict(samples)
# Find the best sample.
best_idx = np.argmin(y_pred) if self.minimize else np.argmax(y_pred)
best_sample = samples[best_idx, :]
# Convert the sample to a parameterization.
candidate = {
p_name: best_sample[i].item()
for i, p_name in enumerate(self.parameters.keys())
}
return candidate
Construct the GenerationStrategy
We will use Sobol for the first 25 trials and defer to random forest for the rest.
generation_strategy = GenerationStrategy(
name="Sobol+RandomForest",
nodes=[
GenerationNode(
node_name="Sobol",
generator_specs=[GeneratorSpec(Generators.SOBOL)],
transition_criteria=[
MaxTrials(
# This specifies the maximum number of trials to generate from this node,
# and the next node in the strategy.
threshold=25,
block_transition_if_unmet=True,
transition_to="RandomForest",
)
],
),
RandomForestGenerationNode(num_samples=128, regressor_options={}),
],
)
Run a simple experiment using the Client
More details on how to use the Client
can be found in the following
tutorial.
# Define the Hartmann6 function which we will minimize.
def hartmann6(x1, x2, x3, x4, x5, x6):
alpha = np.array([1.0, 1.2, 3.0, 3.2])
A = np.array(
[
[10, 3, 17, 3.5, 1.7, 8],
[0.05, 10, 17, 0.1, 8, 14],
[3, 3.5, 1.7, 10, 17, 8],
[17, 8, 0.05, 10, 0.1, 14],
]
)
P = 10**-4 * np.array(
[
[1312, 1696, 5569, 124, 8283, 5886],
[2329, 4135, 8307, 3736, 1004, 9991],
[2348, 1451, 3522, 2883, 3047, 6650],
[4047, 8828, 8732, 5743, 1091, 381],
]
)
outer = 0.0
for i in range(4):
inner = 0.0
for j, x in enumerate([x1, x2, x3, x4, x5, x6]):
inner += A[i, j] * (x - P[i, j]) ** 2
outer += alpha[i] * np.exp(-inner)
return -outer
Configure the experiment and set is GenerationStrategy to be our Sobol+RandomForest strategy defined previously.
client = Client()
client.configure_experiment(
parameters=[
RangeParameterConfig(name=f"x{i}", parameter_type="float", bounds=(0, 1))
for i in range(1, 7)
]
)
client.configure_optimization(objective="-1 * hartmann6")
client.set_generation_strategy(generation_strategy=generation_strategy)
Run the optimization loop as you would conduct any other Ax experiment. Under the hood
Ax will dispatch to your custom ExternalGenerationNode
when generating new candidate
trials.
for _ in range(50): # Run 50 rounds of trials (25 Sobol points, 25 with the RandomForest node)
trials = client.get_next_trials(max_trials=1)
for trial_index, parameters in trials.items():
x1 = parameters["x1"]
x2 = parameters["x2"]
x3 = parameters["x3"]
x4 = parameters["x4"]
x5 = parameters["x5"]
x6 = parameters["x6"]
# Set raw_data as a dictionary with metric names as keys and results as values
raw_data = {"hartmann6": hartmann6(x1, x2, x3, x4, x5, x6)}
# Complete the trial with the result
client.complete_trial(trial_index=trial_index, raw_data=raw_data)
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 0 with parameters {'x1': 0.331417, 'x2': 0.440283, 'x3': 0.726876, 'x4': 0.133118, 'x5': 0.686948, 'x6': 0.357847} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 0 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 1 with parameters {'x1': 0.884509, 'x2': 0.714793, 'x3': 0.310586, 'x4': 0.909164, 'x5': 0.226006, 'x6': 0.971387} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 1 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 2 with parameters {'x1': 0.643623, 'x2': 0.011294, 'x3': 0.781757, 'x4': 0.262352, 'x5': 0.355122, 'x6': 0.577043} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 2 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 3 with parameters {'x1': 0.072219, 'x2': 0.768293, 'x3': 0.241077, 'x4': 0.537163, 'x5': 0.800431, 'x6': 0.189669} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 3 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 4 with parameters {'x1': 0.179923, 'x2': 0.134754, 'x3': 0.453114, 'x4': 0.655867, 'x5': 0.969291, 'x6': 0.441183} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 4 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 5 with parameters {'x1': 0.596556, 'x2': 0.891446, 'x3': 0.525044, 'x4': 0.426942, 'x5': 0.430225, 'x6': 0.827246} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 5 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 6 with parameters {'x1': 0.867624, 'x2': 0.313191, 'x3': 0.007002, 'x4': 0.776788, 'x5': 0.051056, 'x6': 0.72198} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 6 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 7 with parameters {'x1': 0.408755, 'x2': 0.587521, 'x3': 0.954542, 'x4': 0.048605, 'x5': 0.605739, 'x6': 0.108956} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 7 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 8 with parameters {'x1': 0.45363, 'x2': 0.07053, 'x3': 0.097225, 'x4': 0.49651, 'x5': 0.153843, 'x6': 0.171054} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 8 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 9 with parameters {'x1': 0.760156, 'x2': 0.829174, 'x3': 0.927578, 'x4': 0.709743, 'x5': 0.692909, 'x6': 0.535111} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 9 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 10 with parameters {'x1': 0.516401, 'x2': 0.376407, 'x3': 0.417329, 'x4': 0.11777, 'x5': 0.821544, 'x6': 0.890271} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 10 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 11 with parameters {'x1': 0.197424, 'x2': 0.648785, 'x3': 0.622072, 'x4': 0.830273, 'x5': 0.266861, 'x6': 0.253418} using GenerationNode Sobol.
[INFO 09-21 05:09:31] ax.api.client: Trial 11 marked COMPLETED.
[INFO 09-21 05:09:31] ax.api.client: Generated new trial 12 with parameters {'x1': 0.058499, 'x2': 0.253039, 'x3': 0.816534, 'x4': 0.980128, 'x5': 0.439858, 'x6': 0.00245} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 12 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 13 with parameters {'x1': 0.719746, 'x2': 0.525601, 'x3': 0.143042, 'x4': 0.188528, 'x5': 0.900799, 'x6': 0.639034} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 13 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 14 with parameters {'x1': 0.995758, 'x2': 0.197591, 'x3': 0.637662, 'x4': 0.608717, 'x5': 0.522095, 'x6': 0.783241} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 14 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 15 with parameters {'x1': 0.28251, 'x2': 0.956537, 'x3': 0.338559, 'x4': 0.318331, 'x5': 0.076787, 'x6': 0.420735} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 15 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 16 with parameters {'x1': 0.278533, 'x2': 0.223593, 'x3': 0.893497, 'x4': 0.800621, 'x5': 0.772771, 'x6': 0.676555} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 16 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 17 with parameters {'x1': 0.945151, 'x2': 0.997919, 'x3': 0.06705, 'x4': 0.024895, 'x5': 0.327454, 'x6': 0.054772} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 17 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 18 with parameters {'x1': 0.71628, 'x2': 0.294664, 'x3': 0.588036, 'x4': 0.678834, 'x5': 0.191022, 'x6': 0.394779} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 18 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 19 with parameters {'x1': 0.007426, 'x2': 0.551359, 'x3': 0.387199, 'x4': 0.403854, 'x5': 0.651956, 'x6': 0.77404} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 19 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 20 with parameters {'x1': 0.240558, 'x2': 0.421692, 'x3': 0.177123, 'x4': 0.285272, 'x5': 0.570999, 'x6': 0.524781} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 20 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 21 with parameters {'x1': 0.543666, 'x2': 0.678695, 'x3': 0.84671, 'x4': 0.514365, 'x5': 0.016308, 'x6': 0.146228} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 21 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 22 with parameters {'x1': 0.802841, 'x2': 0.100196, 'x3': 0.372594, 'x4': 0.157149, 'x5': 0.402809, 'x6': 0.306564} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 22 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 23 with parameters {'x1': 0.481422, 'x2': 0.874703, 'x3': 0.667791, 'x4': 0.885011, 'x5': 0.941868, 'x6': 0.926968} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 23 marked COMPLETED.
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 24 with parameters {'x1': 0.405202, 'x2': 0.357506, 'x3': 0.274582, 'x4': 0.570224, 'x5': 0.302456, 'x6': 0.864798} using GenerationNode Sobol.
[INFO 09-21 05:09:32] ax.api.client: Trial 24 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 25 with parameters {'x1': 0.242848, 'x2': 0.766958, 'x3': 0.144753, 'x4': 0.339223, 'x5': 0.553891, 'x6': 0.036107} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 25 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 26 with parameters {'x1': 0.483604, 'x2': 0.506459, 'x3': 0.47215, 'x4': 0.584948, 'x5': 0.259142, 'x6': 0.961842} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 26 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 27 with parameters {'x1': 0.638819, 'x2': 0.635674, 'x3': 0.084228, 'x4': 0.144131, 'x5': 0.680864, 'x6': 0.017266} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 27 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 28 with parameters {'x1': 0.260773, 'x2': 0.896815, 'x3': 0.559878, 'x4': 0.686772, 'x5': 0.15346, 'x6': 0.609451} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 28 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 29 with parameters {'x1': 0.125019, 'x2': 0.278793, 'x3': 0.332179, 'x4': 0.771631, 'x5': 0.54654, 'x6': 0.061237} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 29 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 30 with parameters {'x1': 0.884537, 'x2': 0.487939, 'x3': 0.122992, 'x4': 0.768143, 'x5': 0.562872, 'x6': 0.26195} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 30 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:32] ax.api.client: Generated new trial 31 with parameters {'x1': 0.271196, 'x2': 0.566097, 'x3': 0.8093, 'x4': 0.50328, 'x5': 0.117585, 'x6': 0.884512} using GenerationNode RandomForest.
[INFO 09-21 05:09:32] ax.api.client: Trial 31 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 32 with parameters {'x1': 0.320206, 'x2': 0.722646, 'x3': 0.663946, 'x4': 0.466369, 'x5': 0.826566, 'x6': 0.922746} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 32 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 33 with parameters {'x1': 0.122749, 'x2': 0.299301, 'x3': 0.773283, 'x4': 0.242459, 'x5': 0.686683, 'x6': 0.744457} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 33 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 34 with parameters {'x1': 0.886963, 'x2': 0.084726, 'x3': 0.896356, 'x4': 0.713198, 'x5': 0.576136, 'x6': 0.117818} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 34 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 35 with parameters {'x1': 0.738438, 'x2': 0.992811, 'x3': 0.165132, 'x4': 0.933638, 'x5': 0.414243, 'x6': 0.037996} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 35 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 36 with parameters {'x1': 0.532045, 'x2': 0.252672, 'x3': 0.848211, 'x4': 0.479989, 'x5': 0.913371, 'x6': 0.950651} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 36 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 37 with parameters {'x1': 0.5701, 'x2': 0.646536, 'x3': 0.653522, 'x4': 0.510946, 'x5': 0.03968, 'x6': 0.898508} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 37 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 38 with parameters {'x1': 0.633296, 'x2': 0.508261, 'x3': 0.120722, 'x4': 0.199435, 'x5': 0.597074, 'x6': 0.258951} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 38 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 39 with parameters {'x1': 0.729472, 'x2': 0.471035, 'x3': 0.45584, 'x4': 0.884497, 'x5': 0.33883, 'x6': 0.577395} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 39 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 40 with parameters {'x1': 0.696179, 'x2': 0.219478, 'x3': 0.336892, 'x4': 0.329622, 'x5': 0.33116, 'x6': 0.385098} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 40 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 41 with parameters {'x1': 0.605244, 'x2': 0.910719, 'x3': 0.94642, 'x4': 0.425336, 'x5': 0.698403, 'x6': 0.471982} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 41 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:33] ax.api.client: Generated new trial 42 with parameters {'x1': 0.977949, 'x2': 0.904655, 'x3': 0.055582, 'x4': 0.749028, 'x5': 0.814394, 'x6': 0.330281} using GenerationNode RandomForest.
[INFO 09-21 05:09:33] ax.api.client: Trial 42 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 43 with parameters {'x1': 0.852869, 'x2': 0.15347, 'x3': 0.742763, 'x4': 0.972014, 'x5': 0.896605, 'x6': 0.554705} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 43 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 44 with parameters {'x1': 0.588709, 'x2': 0.527721, 'x3': 0.167654, 'x4': 0.066855, 'x5': 0.503505, 'x6': 0.225451} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 44 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 45 with parameters {'x1': 0.986062, 'x2': 0.691918, 'x3': 0.597749, 'x4': 0.909848, 'x5': 0.217368, 'x6': 0.702613} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 45 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 46 with parameters {'x1': 0.030735, 'x2': 0.341686, 'x3': 0.529146, 'x4': 0.432684, 'x5': 0.114867, 'x6': 0.955257} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 46 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 47 with parameters {'x1': 0.676377, 'x2': 0.400062, 'x3': 0.656862, 'x4': 0.473236, 'x5': 0.883026, 'x6': 0.758763} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 47 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 48 with parameters {'x1': 0.826151, 'x2': 0.234512, 'x3': 0.835579, 'x4': 0.724106, 'x5': 0.058299, 'x6': 0.728682} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 48 marked COMPLETED.
/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/sklearn/base.py:1365: DataConversionWarning:
A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
[INFO 09-21 05:09:34] ax.api.client: Generated new trial 49 with parameters {'x1': 0.131432, 'x2': 0.388241, 'x3': 0.488445, 'x4': 0.801837, 'x5': 0.57145, 'x6': 0.700262} using GenerationNode RandomForest.
[INFO 09-21 05:09:34] ax.api.client: Trial 49 marked COMPLETED.
View your results by computing Analyses. Not all Analyses implemented by Ax will be
compatible with an ExternalGenerationNode
(specifically those which rely on an Ax
Adapter
for their input data) though many which rely solely on raw observation will
work out of the box.
client.compute_analyses(
analyses=[ArmEffectsPlot(use_model_predictions=False), Summary()]
)
Observed Arm Effects on hartmann6
Observed effects on hartmann6. This plot visualizes the effects from previously-run arms on a specific metric, providing insights into their performance. This plot allows one to compare and contrast the effectiveness of different arms, highlighting which configurations have yielded the most favorable outcomes.
Summary for Experiment
High-level summary of the Trial
-s in this Experiment
trial_index | arm_name | trial_status | generation_node | hartmann6 | x1 | x2 | x3 | x4 | x5 | x6 | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0_0 | COMPLETED | Sobol | -0.269859 | 0.331417 | 0.440283 | 0.726876 | 0.133118 | 0.686948 | 0.357847 |
1 | 1 | 1_0 | COMPLETED | Sobol | -0.006482 | 0.884509 | 0.714793 | 0.310586 | 0.909164 | 0.226006 | 0.971387 |
2 | 2 | 2_0 | COMPLETED | Sobol | -1.14191 | 0.643623 | 0.011294 | 0.781757 | 0.262352 | 0.355122 | 0.577043 |
3 | 3 | 3_0 | COMPLETED | Sobol | -0.301393 | 0.072219 | 0.768293 | 0.241077 | 0.537163 | 0.800431 | 0.189669 |
4 | 4 | 4_0 | COMPLETED | Sobol | -0.156182 | 0.179923 | 0.134754 | 0.453114 | 0.655867 | 0.969291 | 0.441183 |
5 | 5 | 5_0 | COMPLETED | Sobol | -0.153504 | 0.596556 | 0.891446 | 0.525044 | 0.426942 | 0.430225 | 0.827246 |
6 | 6 | 6_0 | COMPLETED | Sobol | -0.020048 | 0.867624 | 0.313191 | 0.007002 | 0.776788 | 0.051056 | 0.72198 |
7 | 7 | 7_0 | COMPLETED | Sobol | -0.101597 | 0.408755 | 0.587521 | 0.954542 | 0.048605 | 0.605739 | 0.108956 |
8 | 8 | 8_0 | COMPLETED | Sobol | -0.154312 | 0.45363 | 0.07053 | 0.097225 | 0.49651 | 0.153843 | 0.171054 |
9 | 9 | 9_0 | COMPLETED | Sobol | -0.011512 | 0.760156 | 0.829174 | 0.927578 | 0.709743 | 0.692909 | 0.535111 |
10 | 10 | 10_0 | COMPLETED | Sobol | -0.07771 | 0.516401 | 0.376407 | 0.417329 | 0.11777 | 0.821544 | 0.890271 |
11 | 11 | 11_0 | COMPLETED | Sobol | -0.29325 | 0.197424 | 0.648785 | 0.622072 | 0.830273 | 0.266861 | 0.253418 |
12 | 12 | 12_0 | COMPLETED | Sobol | -0.004154 | 0.058499 | 0.253039 | 0.816534 | 0.980128 | 0.439858 | 0.00245 |
13 | 13 | 13_0 | COMPLETED | Sobol | -0.003071 | 0.719746 | 0.525601 | 0.143042 | 0.188528 | 0.900799 | 0.639034 |
14 | 14 | 14_0 | COMPLETED | Sobol | -0.113863 | 0.995758 | 0.197591 | 0.637662 | 0.608717 | 0.522095 | 0.783241 |
15 | 15 | 15_0 | COMPLETED | Sobol | -0.244439 | 0.28251 | 0.956537 | 0.338559 | 0.318331 | 0.076787 | 0.420735 |
16 | 16 | 16_0 | COMPLETED | Sobol | -0.02041 | 0.278533 | 0.223593 | 0.893497 | 0.800621 | 0.772771 | 0.676555 |
17 | 17 | 17_0 | COMPLETED | Sobol | -0.002077 | 0.945151 | 0.997919 | 0.06705 | 0.024895 | 0.327454 | 0.054772 |
18 | 18 | 18_0 | COMPLETED | Sobol | -0.132931 | 0.71628 | 0.294664 | 0.588036 | 0.678834 | 0.191022 | 0.394779 |
19 | 19 | 19_0 | COMPLETED | Sobol | -0.291995 | 0.007426 | 0.551359 | 0.387199 | 0.403854 | 0.651956 | 0.77404 |
20 | 20 | 20_0 | COMPLETED | Sobol | -0.605152 | 0.240558 | 0.421692 | 0.177123 | 0.285272 | 0.570999 | 0.524781 |
21 | 21 | 21_0 | COMPLETED | Sobol | -1.36121 | 0.543666 | 0.678695 | 0.84671 | 0.514365 | 0.016308 | 0.146228 |
22 | 22 | 22_0 | COMPLETED | Sobol | -0.291513 | 0.802841 | 0.100196 | 0.372594 | 0.157149 | 0.402809 | 0.306564 |
23 | 23 | 23_0 | COMPLETED | Sobol | -0.001766 | 0.481422 | 0.874703 | 0.667791 | 0.885011 | 0.941868 | 0.926968 |
24 | 24 | 24_0 | COMPLETED | Sobol | -0.778606 | 0.405202 | 0.357506 | 0.274582 | 0.570224 | 0.302456 | 0.864798 |
25 | 25 | 25_0 | COMPLETED | RandomForest | -1.02276 | 0.242848 | 0.766958 | 0.144753 | 0.339223 | 0.553891 | 0.036107 |
26 | 26 | 26_0 | COMPLETED | RandomForest | -0.413967 | 0.483604 | 0.506459 | 0.47215 | 0.584948 | 0.259142 | 0.961842 |
27 | 27 | 27_0 | COMPLETED | RandomForest | -0.115167 | 0.638819 | 0.635674 | 0.084228 | 0.144131 | 0.680864 | 0.017266 |
28 | 28 | 28_0 | COMPLETED | RandomForest | -0.092468 | 0.260773 | 0.896815 | 0.559878 | 0.686772 | 0.15346 | 0.609451 |
29 | 29 | 29_0 | COMPLETED | RandomForest | -0.040116 | 0.125019 | 0.278793 | 0.332179 | 0.771631 | 0.54654 | 0.061237 |
30 | 30 | 30_0 | COMPLETED | RandomForest | -0.010455 | 0.884537 | 0.487939 | 0.122992 | 0.768143 | 0.562872 | 0.26195 |
31 | 31 | 31_0 | COMPLETED | RandomForest | -1.06361 | 0.271196 | 0.566097 | 0.8093 | 0.50328 | 0.117585 | 0.884512 |
32 | 32 | 32_0 | COMPLETED | RandomForest | -0.052933 | 0.320206 | 0.722646 | 0.663946 | 0.466369 | 0.826566 | 0.922746 |
33 | 33 | 33_0 | COMPLETED | RandomForest | -0.462311 | 0.122749 | 0.299301 | 0.773283 | 0.242459 | 0.686683 | 0.744457 |
34 | 34 | 34_0 | COMPLETED | RandomForest | -0.002432 | 0.886963 | 0.084726 | 0.896356 | 0.713198 | 0.576136 | 0.117818 |
35 | 35 | 35_0 | COMPLETED | RandomForest | -0.116222 | 0.738438 | 0.992811 | 0.165132 | 0.933638 | 0.414243 | 0.037996 |
36 | 36 | 36_0 | COMPLETED | RandomForest | -0.012923 | 0.532045 | 0.252672 | 0.848211 | 0.479989 | 0.913371 | 0.950651 |
37 | 37 | 37_0 | COMPLETED | RandomForest | -0.437027 | 0.5701 | 0.646536 | 0.653522 | 0.510946 | 0.03968 | 0.898508 |
38 | 38 | 38_0 | COMPLETED | RandomForest | -0.113102 | 0.633296 | 0.508261 | 0.120722 | 0.199435 | 0.597074 | 0.258951 |
39 | 39 | 39_0 | COMPLETED | RandomForest | -0.032803 | 0.729472 | 0.471035 | 0.45584 | 0.884497 | 0.33883 | 0.577395 |
40 | 40 | 40_0 | COMPLETED | RandomForest | -0.814356 | 0.696179 | 0.219478 | 0.336892 | 0.329622 | 0.33116 | 0.385098 |
41 | 41 | 41_0 | COMPLETED | RandomForest | -0.096007 | 0.605244 | 0.910719 | 0.94642 | 0.425336 | 0.698403 | 0.471982 |
42 | 42 | 42_0 | COMPLETED | RandomForest | -0.002491 | 0.977949 | 0.904655 | 0.055582 | 0.749028 | 0.814394 | 0.330281 |
43 | 43 | 43_0 | COMPLETED | RandomForest | -0.000342 | 0.852869 | 0.15347 | 0.742763 | 0.972014 | 0.896605 | 0.554705 |
44 | 44 | 44_0 | COMPLETED | RandomForest | -0.10887 | 0.588709 | 0.527721 | 0.167654 | 0.066855 | 0.503505 | 0.225451 |
45 | 45 | 45_0 | COMPLETED | RandomForest | -0.057537 | 0.986062 | 0.691918 | 0.597749 | 0.909848 | 0.217368 | 0.702613 |
46 | 46 | 46_0 | COMPLETED | RandomForest | -0.790354 | 0.030735 | 0.341686 | 0.529146 | 0.432684 | 0.114867 | 0.955257 |
47 | 47 | 47_0 | COMPLETED | RandomForest | -0.018813 | 0.676377 | 0.400062 | 0.656862 | 0.473236 | 0.883026 | 0.758763 |
48 | 48 | 48_0 | COMPLETED | RandomForest | -0.334881 | 0.826151 | 0.234512 | 0.835579 | 0.724106 | 0.058299 | 0.728682 |
49 | 49 | 49_0 | COMPLETED | RandomForest | -0.129369 | 0.131432 | 0.388241 | 0.488445 | 0.801837 | 0.57145 | 0.700262 |
[<ax.analysis.plotly.plotly_analysis.PlotlyAnalysisCard at 0x7efdc2707ce0>,
<ax.analysis.analysis_card.AnalysisCard at 0x7efdc1c8efc0>]