BayesianOpt¶
sgptools.methods.BayesianOpt
¶
Bases: Method
Implements informative sensor placement/path optimization using Bayesian Optimization.
This method optimizes a given objective function (e.g., Mutual Information) by sampling and evaluating points in the search space, building a surrogate model, and using an acquisition function to guide further sampling.
Refer to the following papers for more details
- UAV route planning for active disease classification [Vivaldini et al., 2019]
- Occupancy map building through Bayesian exploration [Francis et al., 2019]
Attributes:
Name | Type | Description |
---|---|---|
objective |
object
|
The objective function to be optimized. |
transform |
Optional[Transform]
|
Transform object applied to inducing points. |
pbounds |
Dict[str, Tuple[float, float]]
|
Dictionary defining the search space bounds. |
Source code in sgptools/methods.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
__init__(num_sensing, X_objective, kernel, noise_variance, transform=None, num_robots=1, X_candidates=None, num_dim=None, objective='SLogMI', **kwargs)
¶
Initializes the BayesianOpt optimizer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_sensing
|
int
|
Number of sensing locations to optimize. |
required |
X_objective
|
ndarray
|
(n, d); Data points used to define the objective function. |
required |
kernel
|
Kernel
|
GPflow kernel function. |
required |
noise_variance
|
float
|
Data noise variance. |
required |
transform
|
Optional[Transform]
|
Transform object to apply to inducing points. Defaults to None. |
None
|
num_robots
|
int
|
Number of robots/agents. Defaults to 1. |
1
|
X_candidates
|
Optional[ndarray]
|
(c, d); Discrete set of candidate locations for sensor placement. Defaults to None. |
None
|
num_dim
|
Optional[int]
|
Dimensionality of the sensing locations. Defaults to dimensonality of X_objective. |
None
|
objective
|
Union[str, Any]
|
The objective function to use. Can be a string ('SLogMI', 'MI') or an instance of an objective class. Defaults to 'SLogMI'. |
'SLogMI'
|
**kwargs
|
Any
|
Additional keyword arguments passed to the objective function. |
{}
|
Source code in sgptools/methods.py
get_hyperparameters()
¶
Retrieves the current kernel and noise variance hyperparameters from the objective.
Returns:
Type | Description |
---|---|
Tuple[Kernel, float]
|
Tuple[gpflow.kernels.Kernel, float]: A tuple containing a deep copy of the kernel and the noise variance. |
Source code in sgptools/methods.py
optimize(max_steps=50, init_points=10, verbose=False, seed=None, **kwargs)
¶
Optimizes the sensor placement/path using Bayesian Optimization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_steps
|
int
|
Maximum number of optimization steps (iterations). Defaults to 50. |
50
|
init_points
|
int
|
Number of random exploration steps before Bayesian Optimization starts. Defaults to 10. |
10
|
verbose
|
bool
|
Verbosity, if True additional details will by reported. Defaults to False. |
False
|
seed
|
Optional[int]
|
Random seed for reproducibility. Defaults to None. |
None
|
**kwargs
|
Any
|
Additional keyword arguments for the optimizer. |
{}
|
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: (num_robots, num_sensing, num_dim); Optimized sensing locations. |
Usage
# Assuming X_train, candidates, kernel_opt, noise_variance_opt are defined
bo_method = BayesianOpt(
num_sensing=10,
X_objective=X_train,
kernel=kernel_opt,
noise_variance=noise_variance_opt,
transform=IPPTransform(num_robots=1), # Example transform
X_candidates=candidates
)
optimized_solution = bo_method.optimize(max_steps=50, init_points=10)
Source code in sgptools/methods.py
update(kernel, noise_variance)
¶
Updates the kernel and noise variance parameters of the objective function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kernel
|
Kernel
|
Updated GPflow kernel function. |
required |
noise_variance
|
float
|
Updated data noise variance. |
required |