emukit.core package¶
Subpackages¶
- emukit.core.acquisition package
- emukit.core.initial_designs package
- emukit.core.interfaces package
- emukit.core.loop package
- Submodules
CandidatePointCalculator
SequentialPointCalculator
GreedyBatchPointCalculator
RandomSampling
LoopState
create_loop_state()
ModelUpdater
NoopModelUpdater
FixedIntervalUpdater
OuterLoop
StoppingCondition
And
Or
FixedIterationsStoppingCondition
ConvergenceStoppingCondition
UserFunction
UserFunctionWrapper
MultiSourceFunctionWrapper
UserFunctionResult
- Module contents
- Submodules
- emukit.core.optimization package
- Submodules
AcquisitionOptimizerBase
AnchorPointsGenerator
ObjectiveAnchorPointsGenerator
ContextManager
GradientAcquisitionOptimizer
LocalSearchAcquisitionOptimizer
MultiSourceAcquisitionOptimizer
Optimizer
OptLbfgs
apply_optimizer()
OptimizationWithContext
OptTrustRegionConstrained
RandomSearchAcquisitionOptimizer
- Module contents
- Submodules
Submodules¶
- class emukit.core.categorical_parameter.CategoricalParameter(name, encoding)¶
Bases:
Parameter
- property encodings: ndarray¶
- Return type
ndarray
- property model_parameters: List¶
Gives the list of single dimensional model parameters the parameter corresponds to.
- Return type
- round(x)¶
Rounds the values of x to fit to the parameter domain, if needed.
- Parameters
x (
ndarray
) – 2d array of values to be rounded.- Return type
ndarray
- Returns
A 2d array of rounded values.
- property bounds: List[Tuple]¶
Returns a list of tuples containing where each tuple contains the minimum and maximum of the variables used to encode the categorical parameter..
- check_in_domain(x)¶
Verifies that given values lie within the parameter’s domain
- Parameters
x (
ndarray
) – 2d numpy array with shape (points, encoding) of points to check- Return type
- Returns
A boolean value which indicates whether all points lie in the domain
- class emukit.core.constraints.IConstraint¶
Bases:
object
- evaluate(x)¶
- Parameters
x (
ndarray
) – Array of shape (n_points x n_dims) containing input locations to evaluate constraint at- Return type
ndarray
- Returns
Numpy array of shape (n_input,) where an element will be 1 if the corresponding input satisfies the constraint and zero if the constraint is violated
- class emukit.core.constraints.InequalityConstraint(lower_bound, upper_bound)¶
Bases:
IConstraint
- class emukit.core.constraints.LinearInequalityConstraint(constraint_matrix, lower_bound=None, upper_bound=None)¶
Bases:
InequalityConstraint
Constraint of the form lower_bound <= Ax <= upper_bound where the matrix A is called “constraint_matrix”
- evaluate(x)¶
Evaluate whether constraints are violated or satisfied at a set of x locations
- Parameters
x (
ndarray
) – Array of shape (n_points x n_dims) containing input locations to evaluate constraint at- Return type
ndarray
- Returns
Numpy array of shape (n_points, ) where an element will be 1 if the corresponding input satisfies all constraints and zero if any constraint is violated
- class emukit.core.constraints.NonlinearInequalityConstraint(constraint_function, lower_bound, upper_bound, jacobian_fun=None)¶
Bases:
InequalityConstraint
Constraint of the form lower_bound <= g(x) <= upper_bound
- evaluate(x)¶
Evaluate whether constraints are violated or satisfied at a set of x locations
- Parameters
x (
ndarray
) – Array of shape (n_points x n_dims) containing input locations to evaluate constraint at- Return type
ndarray
- Returns
Numpy array of shape (n_input,) where an element will be 1 if the corresponding input satisfies the constraint and zero if the constraint is violated
- class emukit.core.continuous_parameter.ContinuousParameter(name, min_value, max_value)¶
Bases:
Parameter
A univariate continuous parameter with a domain defined in a range between two values
- check_in_domain(x)¶
Checks if all the points in x lie between the min and max allowed values
- class emukit.core.discrete_parameter.DiscreteParameter(name, domain)¶
Bases:
Parameter
A parameter that takes a discrete set of values where the order and spacing of values is important
- check_in_domain(x)¶
Checks if the points in x are in the set of allowed values
- Parameters
- Return type
- Returns
A boolean indicating whether each point is in domain
- property bounds: List[Tuple]¶
Returns a list containing one tuple of min and max values parameter can take
- round(x)¶
Rounds each row in x to represent a valid value for this discrete variable
- Parameters
x (
ndarray
) – A 2d array Nx1 to be rounded- Return type
ndarray
- Returns
An array Nx1 where each row represents a value from the domain that is closest to the corresponding row in x
- class emukit.core.discrete_parameter.InformationSourceParameter(n_sources)¶
Bases:
DiscreteParameter
- class emukit.core.encodings.Encoding(categories, encodings)¶
Bases:
object
Generic class that represents encodings of categorical variables
- round(x)¶
Rounds each row in 2d array x to represent one of encodings.
- Parameters
x (
ndarray
) – A 2d array to be rounded- Return type
ndarray
- Returns
An array where each row represents an encoding that is closest to the corresponding row in x
- round_row(x_row)¶
Rounds the given row. See “round” method docsting for details.
When subclassing Encoding, it is best to override this method instead of “round”.
- Parameters
x_row – A row to round.
- Returns
A rounded row.
- get_category(encoding)¶
Gets the category corresponding to the encoding.
- class emukit.core.encodings.OneHotEncoding(categories)¶
Bases:
Encoding
- round_row(x_row)¶
Rounds the given row. The highest value is rounded to 1 all other values are rounded to 0
- Parameters
x_row – A row to round.
- Returns
A rounded row.
- class emukit.core.encodings.OrdinalEncoding(categories)¶
Bases:
Encoding
- round_row(x_row)¶
Rounds the given row. See “round” method docsting for details.
When subclassing Encoding, it is best to override this method instead of “round”.
- Parameters
x_row – A row to round.
- Returns
A rounded row.
- class emukit.core.event_handler.EventHandler¶
Bases:
list
A list of callable objects. Calling an instance of this will cause a call to each item in the list in ascending order by index.
Code taken from: https://stackoverflow.com/a/2022629
To subscribe to the event simply append a function to the event handler:
event_handler.append(fcn_to_call_on_event)
- class emukit.core.parameter.Parameter(name)¶
Bases:
object
- property model_parameters: List¶
Gives the list of single dimensional model parameters the parameter corresponds to.
- Return type
- round(x)¶
Rounds the values of x to fit to the parameter domain, if needed.
- Parameters
x (
ndarray
) – 2d array of values to be rounded.- Return type
ndarray
- Returns
A 2d array of rounded values.
- check_in_domain(x)¶
Verifies that given values lie within the parameter’s domain
- Parameters
x (
ndarray
) – Value to be checked- Return type
- Returns
A boolean value which indicates whether all points lie in the domain
- class emukit.core.parameter_space.ParameterSpace(parameters, constraints=None)¶
Bases:
object
Represents parameter space for a given problem.
- find_parameter_index_in_model(parameter_name)¶
Find the indices of the encoding of the specified parameter in the input vector
- property dimensionality¶
- get_parameter_by_name(name)¶
Returns parameter with the given name
- get_bounds()¶
Returns a list of tuples containing the min and max value each parameter can take.
If the parameter space contains categorical variables, the min and max values correspond to each variable used to encode the categorical variables.
- round(x)¶
Rounds given values x to closest valid values within the space.
- Parameters
x (
ndarray
) – A 2d array of values to be rounded- Return type
ndarray
- Returns
A 2d array of rounded values
- check_points_in_domain(x)¶
Checks that each column of x lies in the domain of the corresponding parameter
- Parameters
x (
ndarray
) – 2d numpy array of points to check- Return type
ndarray
- Returns
A 1d numpy array which contains a boolean indicating whether each point is in domain