gpcam 4.8.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gpcam/__init__.py +19 -0
- gpcam/_version.py +24 -0
- gpcam/autonomous_experimenter.py +382 -0
- gpcam/deep_kernel_network.py +1 -0
- gpcam/gp_mcmc.py +1 -0
- gpcam/gp_optimizer.py +821 -0
- gpcam/gp_optimizer_base.py +707 -0
- gpcam/kernels.py +1 -0
- gpcam/surrogate_model.py +366 -0
- gpcam-4.8.3.dist-info/METADATA +183 -0
- gpcam-4.8.3.dist-info/RECORD +15 -0
- gpcam-4.8.3.dist-info/WHEEL +4 -0
- gpcam-4.8.3.dist-info/licenses/AUTHORS.md +19 -0
- gpcam-4.8.3.dist-info/licenses/COPYING +674 -0
- gpcam-4.8.3.dist-info/licenses/LICENSE +31 -0
gpcam/__init__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from ._version import __version__
|
|
3
|
+
except (ImportError, ModuleNotFoundError) as ex:
|
|
4
|
+
raise RuntimeError('Running gpcam from source code requires installation. If you would like an editable source '
|
|
5
|
+
'install, use "pip install -e ." to perform and editable installation.') from ex
|
|
6
|
+
from loguru import logger
|
|
7
|
+
|
|
8
|
+
from .gp_optimizer import GPOptimizer
|
|
9
|
+
from .gp_optimizer import fvGPOptimizer
|
|
10
|
+
from .gp_optimizer import LogGPOptimizer
|
|
11
|
+
from .gp_optimizer import LogitGPOptimizer
|
|
12
|
+
from .gp_mcmc import gpMCMC, ProposalDistribution
|
|
13
|
+
from .autonomous_experimenter import AutonomousExperimenterGP
|
|
14
|
+
from .autonomous_experimenter import AutonomousExperimenterFvGP
|
|
15
|
+
|
|
16
|
+
__all__ = ['GPOptimizer', 'fvGPOptimizer', 'LogGPOptimizer', 'LogitGPOptimizer',
|
|
17
|
+
'AutonomousExperimenterGP', 'AutonomousExperimenterFvGP', 'gpMCMC', 'ProposalDistribution']
|
|
18
|
+
|
|
19
|
+
logger.disable('gpcam')
|
gpcam/_version.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '4.8.3'
|
|
22
|
+
__version_tuple__ = version_tuple = (4, 8, 3)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# /usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import dask
|
|
4
|
+
import numpy as np
|
|
5
|
+
from loguru import logger
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AutonomousExperimenterGP:
|
|
9
|
+
"""
|
|
10
|
+
THE AutonomousExperimenterGP IS DEPRECIATED. PLEASE USE THE GPOptimizer DIRECTLY.
|
|
11
|
+
AN ALTERNATIVE IS THE TSUCHINOKO PACKAGE.
|
|
12
|
+
|
|
13
|
+
This class executes the autonomous loop for a single-task Gaussian process.
|
|
14
|
+
Use class :py:class:`gpcam.AutonomousExperimenterFvGP` for multi-task experiments.
|
|
15
|
+
The AutonomousExperimenter is a convenience-driven functionality that does not allow
|
|
16
|
+
as much customization as using the :py:class:`gpcam.GPOptimizer` directly. But it is a great option to
|
|
17
|
+
get started.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
input_space : np.ndarray
|
|
23
|
+
A numpy array of floats of shape D x 2 describing the input space (bounds).
|
|
24
|
+
The autonomous experimenter is only able to handle Euclidean spaces.
|
|
25
|
+
Please use the :py:class:`gpcam.GPOptimizer` to deal with non-Euclidean cases.
|
|
26
|
+
hyperparameters : np.ndarray, optional
|
|
27
|
+
Vector of hyperparameters used by the GP initially.
|
|
28
|
+
This class provides methods to train hyperparameters.
|
|
29
|
+
The default is a random draw from a uniform distribution
|
|
30
|
+
within hyperparameter_bounds, with a shape appropriate
|
|
31
|
+
for the default kernel (D + 1), which is an anisotropic Matern
|
|
32
|
+
kernel with automatic relevance determination (ARD). If gp2Scale is
|
|
33
|
+
enabled, the default kernel changes to the anisotropic Wendland kernel.
|
|
34
|
+
hyperparameter_bounds : np.ndarray, optional
|
|
35
|
+
A 2d numpy array of shape (N x 2), where N is the number of needed hyperparameters.
|
|
36
|
+
The default is None, in which case the hyperparameter_bounds are estimated from the domain size
|
|
37
|
+
and the initial y_data. If the data changes significantly,
|
|
38
|
+
the hyperparameters and the bounds should be changed/retrained. Initial hyperparameters and bounds
|
|
39
|
+
can also be set in the train calls. The default only works for the default kernels.
|
|
40
|
+
instrument_function : Callable, optional
|
|
41
|
+
A function that takes data points (a list of dicts), and returns the same
|
|
42
|
+
with the measurement data filled in. The function is
|
|
43
|
+
expected to communicate with the instrument and perform measurements,
|
|
44
|
+
populating fields of the data input. `y_data` and `noise variance` have to be filled in.
|
|
45
|
+
init_dataset_size : int, optional
|
|
46
|
+
If `x` and `y` are not provided and `dataset` is not provided,
|
|
47
|
+
`init_dataset_size` must be provided. An initial
|
|
48
|
+
dataset is constructed randomly with this length. The `instrument_function`
|
|
49
|
+
is immediately called to measure values
|
|
50
|
+
at these initial points.
|
|
51
|
+
acquisition_function : Callable, optional
|
|
52
|
+
The acquisition function accepts as input a numpy array
|
|
53
|
+
of size V x D (such that V is the number of input
|
|
54
|
+
points, and D is the parameter space dimensionality) and
|
|
55
|
+
a `GPOptimizer` object. The return value is 1d array
|
|
56
|
+
of length V providing 'scores' for each position,
|
|
57
|
+
such that the highest scored point will be measured next.
|
|
58
|
+
Built-in functions can be used by one of the following keys:
|
|
59
|
+
`ucb`,`lcb`,`maximum`,
|
|
60
|
+
`minimum`, `variance`,`expected_improvement`,
|
|
61
|
+
`relative information entropy`,`relative information entropy set`,
|
|
62
|
+
`probability of improvement`, `gradient`,`total correlation`,`target probability`.
|
|
63
|
+
If None, the default function `variance`, meaning
|
|
64
|
+
`fvgp.GP.posterior_covariance` with variance_only = True will be used.
|
|
65
|
+
The acquisition function can be a callable function of the form my_func(x,gpcam.GPOptimizer)
|
|
66
|
+
which will be maximized (!!!), so make sure desirable new measurement points
|
|
67
|
+
will be located at maxima.
|
|
68
|
+
Explanations of the acquisition functions:
|
|
69
|
+
variance: simply the posterior variance
|
|
70
|
+
relative information entropy: the KL divergence of the prior over predictions and the posterior
|
|
71
|
+
relative information entropy set: the KL divergence of the prior
|
|
72
|
+
defined over predictions and the posterior point-by-point
|
|
73
|
+
ucb: upper confidence bound, posterior mean + 3. std
|
|
74
|
+
lcb: lower confidence bound, -(posterior mean - 3. std)
|
|
75
|
+
maximum: finds the maximum of the current posterior mean
|
|
76
|
+
minimum: finds the maximum of the current posterior mean
|
|
77
|
+
gradient: puts focus on high-gradient regions
|
|
78
|
+
probability of improvement: as the name would suggest
|
|
79
|
+
expected improvement: as the name would suggest
|
|
80
|
+
total correlation: extension of mutual information to more than 2 random variables
|
|
81
|
+
target probability: probability of a target; needs a dictionary
|
|
82
|
+
GPOptimizer.args = {'a': lower bound, 'b': upper bound} to be defined.
|
|
83
|
+
cost_function : Callable, optional
|
|
84
|
+
A function encoding the cost of motion through the input space and the
|
|
85
|
+
cost of a measurements. Its inputs are an
|
|
86
|
+
`origin` (np.ndarray of size V x D), `x` (np.ndarray of size V x D),
|
|
87
|
+
and the value of `cost_function_parameters`;
|
|
88
|
+
`origin` is the starting position, and `x` is the destination position. The return value is a 1d array of
|
|
89
|
+
length V describing the costs as floats. The 'score' from
|
|
90
|
+
acquisition_function is divided by this returned cost to determine
|
|
91
|
+
the next measurement point. If None, the default is a uniform cost of 1.
|
|
92
|
+
cost_update_function : Callable, optional
|
|
93
|
+
A function that updates the `cost_function_parameters` which are communicated to the `cost_function`.
|
|
94
|
+
This function accepts as input
|
|
95
|
+
costs (a list of cost values determined by `instrument_function`), bounds (a V x 2 numpy array) and a parameters
|
|
96
|
+
object. The default is a no-op.
|
|
97
|
+
cost_function_parameters : Any, optional
|
|
98
|
+
An object that is communicated to the `cost_function` and `cost_update_function`. The default is `{}`.
|
|
99
|
+
online : bool, optional
|
|
100
|
+
The default is True. `online=True` will lead to calls to `gpOptimizer.tell(append=True)` which
|
|
101
|
+
potentially saves a lot of time in the GP update. The GP is updated either with an inversion update
|
|
102
|
+
or a Cholesky factor update.
|
|
103
|
+
kernel_function : Callable, optional
|
|
104
|
+
A symmetric positive definite covariance function (a kernel)
|
|
105
|
+
that calculates the covariance between
|
|
106
|
+
data points. It is a function of the form k(x1,x2,hyperparameters).
|
|
107
|
+
The input `x1` is a N1 x D array of positions, `x2` is a N2 x D
|
|
108
|
+
array of positions, the hyperparameters argument
|
|
109
|
+
is a 1d array of length D+1 for the default kernel and of a different
|
|
110
|
+
length for user-defined kernels.
|
|
111
|
+
The default is a stationary anisotropic kernel
|
|
112
|
+
(`fvgp.GP.default_kernel`) which performs automatic relevance determination (ARD).
|
|
113
|
+
The output is a matrix, an N1 x N2 numpy array.
|
|
114
|
+
prior_mean_function : Callable, optional
|
|
115
|
+
A function that evaluates the prior mean at a set of input position. It accepts as input
|
|
116
|
+
an array of positions (of shape N1 x D) and hyperparameters (a 1d array of length D+1 for the default kernel).
|
|
117
|
+
The return value is a 1d array of length N1. If None is provided,
|
|
118
|
+
`fvgp.GP._default_mean_function` is used, which is the average of the `y_data`.
|
|
119
|
+
noise_function : Callable optional
|
|
120
|
+
The noise function is a callable f(x,hyperparameters) that returns a
|
|
121
|
+
vector (1d np.ndarray) of length(x).
|
|
122
|
+
The input `x` is a numpy array of shape (N x D). The hyperparameter array is the same
|
|
123
|
+
that is communicated to mean and kernel functions.
|
|
124
|
+
Only provide a noise function OR a noise variance vector, not both.
|
|
125
|
+
run_every_iteration : Callable, optional
|
|
126
|
+
A function that is run at every iteration. It accepts as input a
|
|
127
|
+
`gpcam.AutonomousExperimenterGP` instance. The default is a no-op.
|
|
128
|
+
x_data : np.ndarray, optional
|
|
129
|
+
Initial data point positions.
|
|
130
|
+
y_data : np.ndarray, optional
|
|
131
|
+
Initial data point values.
|
|
132
|
+
noise_variances : np.ndarray, optional
|
|
133
|
+
Initial data point observation variances.
|
|
134
|
+
dataset : string, optional
|
|
135
|
+
A filename of a gpcam-generated file that is used to initialize a new instance.
|
|
136
|
+
communicate_full_dataset : bool, optional
|
|
137
|
+
If True, the full dataset will be communicated to the `instrument_function`
|
|
138
|
+
on each iteration. If False, only the
|
|
139
|
+
newly suggested data points will be communicated. The default is False.
|
|
140
|
+
compute_device : str, optional
|
|
141
|
+
One of `cpu` or `gpu`, determines how linear algebra computations are executed. The default is `cpu`.
|
|
142
|
+
training_dask_client : distributed.client.Client, optional
|
|
143
|
+
A Dask Distributed Client instance for distributed training. If None is provided, a new
|
|
144
|
+
`dask.distributed.Client` instance is constructed.
|
|
145
|
+
acq_func_opt_dask_client : distributed.client.Client, optional
|
|
146
|
+
A Dask Distributed Client instance for distributed `acquisition_function`
|
|
147
|
+
optimization. If None is provided, a new
|
|
148
|
+
`dask.distributed.Client` instance is constructed.
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
Attributes
|
|
152
|
+
----------
|
|
153
|
+
x_data : np.ndarray
|
|
154
|
+
Data point positions
|
|
155
|
+
y_data : np.ndarray
|
|
156
|
+
Data point values
|
|
157
|
+
noise_variances : np.ndarray
|
|
158
|
+
Data point observation variances
|
|
159
|
+
data.dataset : list
|
|
160
|
+
All data
|
|
161
|
+
hyperparameter_bounds : np.ndarray
|
|
162
|
+
A 2d array of floats of size J x 2, such that J is the length
|
|
163
|
+
matching the length of `hyperparameters` defining
|
|
164
|
+
the bounds for training.
|
|
165
|
+
gp_optimizer : gpcam.GPOptimizer
|
|
166
|
+
A GPOptimizer instance used for initializing a Gaussian process and performing optimization of the posterior.
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
def __init__(self,
|
|
170
|
+
input_space,
|
|
171
|
+
hyperparameters=None,
|
|
172
|
+
hyperparameter_bounds=None,
|
|
173
|
+
instrument_function=None,
|
|
174
|
+
init_dataset_size=None,
|
|
175
|
+
acquisition_function="variance",
|
|
176
|
+
cost_function=None,
|
|
177
|
+
cost_update_function=None,
|
|
178
|
+
cost_function_parameters=None,
|
|
179
|
+
online=True,
|
|
180
|
+
kernel_function=None,
|
|
181
|
+
prior_mean_function=None,
|
|
182
|
+
noise_function=None,
|
|
183
|
+
run_every_iteration=None,
|
|
184
|
+
x_data=None, y_data=None, noise_variances=None, dataset=None,
|
|
185
|
+
communicate_full_dataset=False,
|
|
186
|
+
compute_device="cpu",
|
|
187
|
+
training_dask_client=None,
|
|
188
|
+
acq_func_opt_dask_client=None,
|
|
189
|
+
gp2Scale=False,
|
|
190
|
+
dask_client=None,
|
|
191
|
+
gp2Scale_batch_size=10000,
|
|
192
|
+
ram_economy=True,
|
|
193
|
+
args=None
|
|
194
|
+
):
|
|
195
|
+
|
|
196
|
+
raise Exception("THE AutonomousExperimenterGP IS DEPRECIATED. PLEASE USE THE GPOptimizer DIRECTLY."
|
|
197
|
+
"AN ALTERNATIVE IS THE TSUCHINOKO PACKAGE.")
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
###################################################################################
|
|
201
|
+
###################################################################################
|
|
202
|
+
###################################################################################
|
|
203
|
+
###################################################################################
|
|
204
|
+
###################################################################################
|
|
205
|
+
###################################################################################
|
|
206
|
+
class AutonomousExperimenterFvGP(AutonomousExperimenterGP):
|
|
207
|
+
"""
|
|
208
|
+
THE AutonomousExperimenterFvGP IS DEPRECIATED. PLEASE USE THE FvGPOptimizer DIRECTLY.
|
|
209
|
+
AN ALTERNATIVE IS THE TSUCHINOKO PACKAGE.
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
Executes the autonomous loop for a multi-task Gaussian process.
|
|
213
|
+
|
|
214
|
+
Parameters
|
|
215
|
+
----------
|
|
216
|
+
input_space : np.ndarray
|
|
217
|
+
A numpy array of floats of shape D x 2 describing the input space (bounds).
|
|
218
|
+
The autonomous experimenter is only able to handle Euclidean spaces.
|
|
219
|
+
Please use the :py:class:`gpcam.fvGPOptimizer`to deal with non-Euclidean cases.
|
|
220
|
+
hyperparameters : np.ndarray, optional
|
|
221
|
+
Vector of hyperparameters used by the GP initially.
|
|
222
|
+
This class provides methods to train hyperparameters.
|
|
223
|
+
The default is a random draw from a uniform distribution
|
|
224
|
+
within hyperparameter_bounds, with a shape appropriate
|
|
225
|
+
for the default kernel (D + 1), which is an anisotropic Matern
|
|
226
|
+
kernel with automatic relevance determination (ARD). If gp2Scale is
|
|
227
|
+
enabled, the default kernel changes to the anisotropic Wendland kernel.
|
|
228
|
+
hyperparameter_bounds : np.ndarray, optional
|
|
229
|
+
A 2d numpy array of shape (N x 2), where N is the number of needed hyperparameters.
|
|
230
|
+
The default is None, in which case the hyperparameter_bounds are estimated from the domain size
|
|
231
|
+
and the initial y_data. If the data changes significantly,
|
|
232
|
+
the hyperparameters and the bounds should be changed/retrained. Initial hyperparameters and bounds
|
|
233
|
+
can also be set in the train calls. The default only works for the default kernels.
|
|
234
|
+
instrument_function : Callable, optional
|
|
235
|
+
A function that takes data points (a list of dicts), and returns the same
|
|
236
|
+
with the measurement data filled in. The function is
|
|
237
|
+
expected to communicate with the instrument and perform measurements,
|
|
238
|
+
populating fields of the data input. `y_data` and `noise variances` have to be filled in.
|
|
239
|
+
init_dataset_size : int, optional
|
|
240
|
+
If `x` and `y` are not provided and `dataset` is not provided,
|
|
241
|
+
`init_dataset_size` must be provided. An initial
|
|
242
|
+
dataset is constructed randomly with this length. The `instrument_function`
|
|
243
|
+
is immediately called to measure values
|
|
244
|
+
at these initial points.
|
|
245
|
+
acquisition_function : Callable, optional
|
|
246
|
+
The acquisition function accepts as input a numpy array
|
|
247
|
+
of size V x D (such that V is the number of input
|
|
248
|
+
points, and D is the parameter space dimensionality) and
|
|
249
|
+
a `GPOptimizer` object. The return value is 1d array
|
|
250
|
+
of length V providing 'scores' for each position,
|
|
251
|
+
such that the highest scored point will be measured next.
|
|
252
|
+
Built-in functions can be used by one of the following keys:
|
|
253
|
+
`variance`, `relative information entropy`,
|
|
254
|
+
`relative information entropy set`, `total correlation`.
|
|
255
|
+
See fvGPOptimizer.ask() for a short explanation of these functions.
|
|
256
|
+
In the multi-task case, it is highly recommended to
|
|
257
|
+
deploy a user-defined acquisition function due to the intricate relationship
|
|
258
|
+
of posterior distributions at different points in the output space.
|
|
259
|
+
If None, the default function `variance`, meaning
|
|
260
|
+
`fvgp.GP.posterior_covariance` with variance_only = True will be used.
|
|
261
|
+
The acquisition function can be a callable function of the form my_func(x,gpcam.GPOptimizer)
|
|
262
|
+
which will be maximized (!!!), so make sure desirable new measurement points
|
|
263
|
+
will be located at maxima.
|
|
264
|
+
cost_function : Callable, optional
|
|
265
|
+
A function encoding the cost of motion through the input space and the
|
|
266
|
+
cost of a measurements. Its inputs are an
|
|
267
|
+
`origin` (np.ndarray of size V x D), `x` (np.ndarray of size V x D),
|
|
268
|
+
and the value of `cost_function_parameters`;
|
|
269
|
+
`origin` is the starting position, and `x` is the destination position. The return value is a 1d array of
|
|
270
|
+
length V describing the costs as floats. The 'score' from
|
|
271
|
+
acquisition_function is divided by this returned cost to determine
|
|
272
|
+
the next measurement point. If None, the default is a uniform cost of 1.
|
|
273
|
+
cost_update_function : Callable, optional
|
|
274
|
+
A function that updates the `cost_func_params` which are communicated to the `cost_function`.
|
|
275
|
+
This function accepts as input
|
|
276
|
+
costs (a list of cost values determined by `instrument_function`), bounds (a V x 2 numpy array) and a parameters
|
|
277
|
+
object. The default is a no-op.
|
|
278
|
+
cost_function_parameters : Any, optional
|
|
279
|
+
An object that is communicated to the `cost_function` and `cost_update_function`. The default is `{}`.
|
|
280
|
+
online : bool, optional
|
|
281
|
+
The default is True. `online=True` will lead to calls to `gpOptimizer.tell(append=True)` which
|
|
282
|
+
potentially saves a lot of time in the GP update. The GP is updated either with an inversion update
|
|
283
|
+
or a Cholesky factor update.
|
|
284
|
+
kernel_function : Callable, optional
|
|
285
|
+
A symmetric positive definite covariance function (a kernel)
|
|
286
|
+
that calculates the covariance between
|
|
287
|
+
data points. It is a function of the form k(x1,x2,hyperparameters).
|
|
288
|
+
The input `x1` a N1 x Di+1 array of positions, `x2` is a N2 x Di+1
|
|
289
|
+
array of positions, the hyperparameters argument
|
|
290
|
+
is a 1d array of length N depending on how many hyperparameters are initialized.
|
|
291
|
+
The default is a stationary anisotropic kernel
|
|
292
|
+
(`fvgp.GP.default_kernel`) which performs automatic relevance determination (ARD). The task
|
|
293
|
+
direction is simply considered an additional dimension. This kernel should only be used for tests and in the
|
|
294
|
+
simplest of cases.
|
|
295
|
+
The output is a matrix, an N1 x N2 numpy array.
|
|
296
|
+
prior_mean_function : Callable, optional
|
|
297
|
+
A function that evaluates the prior mean at a set of input position. It accepts as input
|
|
298
|
+
an array of positions (of shape N1 x Di+1) and
|
|
299
|
+
hyperparameters (a 1d array of length Di+2 for the default kernel).
|
|
300
|
+
The return value is a 1d array of length N1. If None is provided,
|
|
301
|
+
`fvgp.GP._default_mean_function` is used, which is the average of the `y_data`.
|
|
302
|
+
noise_function : Callable optional
|
|
303
|
+
The noise function is a callable f(x,hyperparameters) that returns a
|
|
304
|
+
vector (1d np.ndarray) of length(x).
|
|
305
|
+
The input `x` is a numpy array of shape (N x D). The hyperparameter array is the same
|
|
306
|
+
that is communicated to mean and kernel functions.
|
|
307
|
+
Only provide a noise function OR a noise variance vector, not both.
|
|
308
|
+
run_every_iteration : Callable, optional
|
|
309
|
+
A function that is run at every iteration. It accepts as input a
|
|
310
|
+
`gpcam.AutonomousExperimenterGP` instance. The default is a no-op.
|
|
311
|
+
x_data : np.ndarray, optional
|
|
312
|
+
Initial data point positions.
|
|
313
|
+
y_data : np.ndarray, optional
|
|
314
|
+
Initial data point values.
|
|
315
|
+
noise_variances : np.ndarray, optional
|
|
316
|
+
Initial data point observation variances.
|
|
317
|
+
dataset : string, optional
|
|
318
|
+
A filename of a gpcam-generated file that is used to initialize a new instance.
|
|
319
|
+
communicate_full_dataset : bool, optional
|
|
320
|
+
If True, the full dataset will be communicated to the `instrument_function`
|
|
321
|
+
on each iteration. If False, only the
|
|
322
|
+
newly suggested data points will be communicated. The default is False.
|
|
323
|
+
compute_device : str, optional
|
|
324
|
+
One of `cpu` or `gpu`, determines how linear algebra computations are executed. The default is `cpu`.
|
|
325
|
+
training_dask_client : distributed.client.Client, optional
|
|
326
|
+
A Dask Distributed Client instance for distributed training. If None is provided, a new
|
|
327
|
+
`dask.distributed.Client` instance is constructed.
|
|
328
|
+
acq_func_opt_dask_client : distributed.client.Client, optional
|
|
329
|
+
A Dask Distributed Client instance for distributed `acquisition_function`
|
|
330
|
+
optimization. If None is provided, a new
|
|
331
|
+
`dask.distributed.Client` instance is constructed.
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
Attributes
|
|
335
|
+
----------
|
|
336
|
+
x_data : np.ndarray
|
|
337
|
+
Data point positions
|
|
338
|
+
y_data : np.ndarray
|
|
339
|
+
Data point values
|
|
340
|
+
noise_variances : np.ndarray
|
|
341
|
+
Data point observation variances
|
|
342
|
+
data.dataset : list
|
|
343
|
+
All data
|
|
344
|
+
hyperparameter_bounds : np.ndarray
|
|
345
|
+
A 2d array of floats of size J x 2, such that J is the length
|
|
346
|
+
matching the length of `hyperparameters` defining
|
|
347
|
+
the bounds for training.
|
|
348
|
+
gp_optimizer : gpcam.GPOptimizer
|
|
349
|
+
A GPOptimizer instance used for initializing a Gaussian process and performing optimization of the posterior.
|
|
350
|
+
"""
|
|
351
|
+
|
|
352
|
+
def __init__(self,
|
|
353
|
+
input_space,
|
|
354
|
+
hyperparameters=None,
|
|
355
|
+
hyperparameter_bounds=None,
|
|
356
|
+
instrument_function=None,
|
|
357
|
+
init_dataset_size=None,
|
|
358
|
+
acquisition_function="variance",
|
|
359
|
+
cost_function=None,
|
|
360
|
+
cost_update_function=None,
|
|
361
|
+
cost_function_parameters=None,
|
|
362
|
+
online=True,
|
|
363
|
+
kernel_function=None,
|
|
364
|
+
prior_mean_function=None,
|
|
365
|
+
noise_function=None,
|
|
366
|
+
run_every_iteration=None,
|
|
367
|
+
x_data=None, y_data=None, noise_variances=None, dataset=None,
|
|
368
|
+
communicate_full_dataset=False,
|
|
369
|
+
compute_device="cpu",
|
|
370
|
+
training_dask_client=None,
|
|
371
|
+
acq_func_opt_dask_client=None,
|
|
372
|
+
gp2Scale=False,
|
|
373
|
+
dask_client=None,
|
|
374
|
+
gp2Scale_batch_size=10000,
|
|
375
|
+
ram_economy=True,
|
|
376
|
+
args=None
|
|
377
|
+
):
|
|
378
|
+
################################
|
|
379
|
+
# getting the data ready#########
|
|
380
|
+
################################
|
|
381
|
+
raise Exception("THE AutonomousExperimenterFvGP IS DEPRECIATED. PLEASE USE THE FvGPOptimizer DIRECTLY."
|
|
382
|
+
"AN ALTERNATIVE IS THE TSUCHINOKO PACKAGE.")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from fvgp.deep_kernel_network import *
|
gpcam/gp_mcmc.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from fvgp.gp_mcmc import *
|