Objective¶
sgptools.methods.get_objective(objective_name)
¶
Retrieves an objective function class by its string name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
objective_name
|
str
|
The name of the objective function (e.g., 'MI', 'SLogMI'). |
required |
Returns:
Type | Description |
---|---|
Type[Objective]
|
Type[Objective]: The class of the requested objective function. |
Raises:
Type | Description |
---|---|
KeyError
|
If the objective name is not found in the registered OBJECTIVES. |
Usage
Source code in sgptools/objectives.py
sgptools.objectives.Objective
¶
Base class for objective functions used in optimization.
Subclasses must implement the __call__
method to define the objective.
Source code in sgptools/objectives.py
__call__(X)
¶
Computes the objective value for a given set of input points X
.
This method must be implemented by subclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Tensor
|
The input points for which the objective is to be computed. Shape: (M, D) where M is number of points, D is dimension. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
tf.Tensor: The computed objective value. |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If the method is not implemented by a subclass. |
Source code in sgptools/objectives.py
__init__(X_objective, kernel, noise_variance, **kwargs)
¶
Initializes the base objective. This constructor primarily serves to define the expected parameters for all objective subclasses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X_objective
|
ndarray
|
The input data points that define the context or environment for which the objective is calculated. Shape: (N, D) where N is number of points, D is dimension. |
required |
kernel
|
Kernel
|
The GPflow kernel function used in the objective. |
required |
noise_variance
|
float
|
The observed data noise variance. |
required |
**kwargs
|
Any
|
Arbitrary keyword arguments. |
{}
|
Source code in sgptools/objectives.py
update(kernel, noise_variance)
¶
Updates the kernel and noise variance parameters used by the objective function. This method should be overridden by subclasses if they maintain internal state that needs updating (e.g., cached kernel matrices or jitter values).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kernel
|
Kernel
|
The updated GPflow kernel function. |
required |
noise_variance
|
float
|
The updated data noise variance. |
required |