bojaxns
bojaxns
Subpackages
Submodules
Package Contents
- class Trial[source]
Bases:
pydantic.BaseModel- create_dt: datetime.datetime
- param_values: bojaxns.common.ParamValues
- U_value: bojaxns.common.UValue
- trial_updates: Dict[str, TrialUpdate]
- class TrialUpdate[source]
Bases:
pydantic.BaseModel- measurement_dt: datetime.datetime
- class OptimisationExperiment[source]
Bases:
pydantic.BaseModel- parameter_space: bojaxns.parameter_space.ParameterSpace
- class NewExperimentRequest[source]
Bases:
pydantic.BaseModel- parameter_space: bojaxns.parameter_space.ParameterSpace
- init_explore_size: conint(ge=1)
- class AbstractAcquisition[source]
A class that represents any acquisition function. All acquisition functions take a point in the U-domain and returns a metric that gives a proxy as to how valuable it would be to try that point. All acquisition values only make sense relatively.
- class MarginalisedAcquisitionFunction(key, ns_results, acquisition_factory, S)[source]
Bases:
AbstractAcquisitionClass that represents a marginalisation of an acquisition function over samples.
- Parameters:
key (jax.random.PRNGKey) –
ns_results (MarginalisationData) –
acquisition_factory (AcquisitionFactory) –
S (int) –
- class OptimisationExperiment[source]
Bases:
pydantic.BaseModel- parameter_space: bojaxns.parameter_space.ParameterSpace
- class GaussianProcessData[source]
Bases:
NamedTuple- U: jax.numpy.ndarray
- Y: jax.numpy.ndarray
- Y_var: jax.numpy.ndarray
- sample_size: jax.numpy.ndarray
- class GaussianProcessConditionalPredictiveFactory(data)[source]
Bases:
bojaxns.base.ConditionalPredictiveFactory- Parameters:
data (GaussianProcessData) –
- psd_kernels()[source]
- Return type:
List[Type[tensorflow_probability.substrates.jax.math.psd_kernels.PositiveSemidefiniteKernel]]
- class ExpectedImprovementAcquisitionFactory(conditional_predictive_factory)[source]
Bases:
bojaxns.base.AcquisitionFactory- Parameters:
conditional_predictive_factory (GaussianProcessConditionalPredictiveFactory) –
- class TopTwoAcquisitionFactory(conditional_predictive_factory, u1)[source]
Bases:
bojaxns.base.AcquisitionFactory- Parameters:
conditional_predictive_factory (GaussianProcessConditionalPredictiveFactory) –
u1 (jax.numpy.ndarray) –
- run_multi_lookahead(rng_key, data, ns_results, batch_size, max_depth, num_actions, num_simulations, S)[source]
- Parameters:
rng_key (chex.PRNGKey) –
data (bojaxns.gaussian_process_formulation.distribution_math.GaussianProcessData) –
ns_results (bojaxns.base.MarginalisationData) –
batch_size (int) –
max_depth (int) –
num_actions (int) –
num_simulations (int) –
S (int) –
- Return type:
Tuple[chex.Array, mctx.PolicyOutput[mctx.GumbelMuZeroExtraData]]
- convert_tree_to_graph(tree, action_labels=None, batch_index=0)[source]
Converts a search tree into a Graphviz graph.
- class BayesianOptimiser(experiment, num_parallel_solvers=1, beta=0.5, S=512)[source]
- Parameters:
experiment (bojaxns.experiment.OptimisationExperiment) –
num_parallel_solvers (int) –
beta (float) –
S (int) –
- posterior_solve(key)[source]
- Parameters:
key (chex.PRNGKey) –
- Return type:
jaxns.internals.types.NestedSamplerResults
- search_U_top1(key, ns_results, batch_size, num_search)[source]
- Parameters:
key (chex.PRNGKey) –
ns_results (bojaxns.base.MarginalisationData) –
batch_size (int) –
num_search (int) –
- search_U_top2(key, ns_results, u1, batch_size, num_search)[source]
- Parameters:
key (chex.PRNGKey) –
ns_results (bojaxns.base.MarginalisationData) –
u1 (jax.numpy.ndarray) –
batch_size (int) –
num_search (int) –
- class ContinuousPrior[source]
Bases:
pydantic.BaseModel- type: Literal[continuous_prior] = 'continuous_prior'
- uncert: confloat(gt=0.0)
- class IntegerPrior[source]
Bases:
pydantic.BaseModel- type: Literal[integer_prior] = 'integer_prior'
- uncert: confloat(gt=0.0)
- class CategoricalPrior[source]
Bases:
pydantic.BaseModel- type: Literal[categorical_prior] = 'categorical_prior'
- probs: List[confloat(ge=0.0)]
- build_prior_model(parameter_space)[source]
Constructs a prior model given the parameter space.
- Parameters:
parameter_space (ParameterSpace) –
Returns:
- exception InvalidTrial[source]
Bases:
ExceptionCommon base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- class BayesianOptimisation(experiment)[source]
- Parameters:
experiment (bojaxns.experiment.OptimisationExperiment) –
- property experiment
- classmethod create_new_experiment(new_experiment)[source]
- Parameters:
new_experiment (bojaxns.experiment.NewExperimentRequest) –
- Return type:
- add_trial_from_data(key, param_values)[source]
- Parameters:
key (jax._src.random.PRNGKey) –
param_values (bojaxns.common.ParamValues) –
- Return type:
- post_measurement(trial_id, trial_update)[source]
- Parameters:
trial_id (str) –
trial_update (bojaxns.experiment.TrialUpdate) –
- latin_hypercube(seed, num_samples, num_dim)[source]
Sample from the latin-hypercube defined as the continuous analog of the discrete latin-hypercube. That is, if you partition each dimension into num_samples equal volume intervals then there is (conditionally) exactly one point in each interval. We guarantee that uniformity by randomly assigning the permutation of each dimension. The degree of randomness is controlled by cube_scale. A value of 0 places the sample at the center of the grid point, and a value of 1 places the value randomly inside the grid-cell.