Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/source/api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ To get to know gpCAM, check out the [examples](../examples/index.md), download t
repository and look in `./tests`, or visit the project
[website](https://gpcam.lbl.gov/).

## New in fvgp 4.8 (gpCAM 8.4)

Because the optimizers inherit from `fvgp.GP`, the following fvgp 4.8 additions are
available directly on any `GPOptimizer`/`fvGPOptimizer` instance and are listed on the
[gpOptimizer](gpOptimizer.md) / [fvgpOptimizer](fvgpOptimizer.md) pages:

- **Model-validation metrics** — `mae`, `mape`, `msll`, `interval_score`, `mpiw`, and
`coverage_curve` for quantifying predictive accuracy and calibration, plus
`plot_observed_vs_predicted` for a quick diagnostic plot.
- **New kernels** — `bump` and `sle_kernel` (in addition to the existing library), all
re-exported through `gpcam.kernels` and documented on the [Kernels](kernels.md) page.
- **Linear-algebra modes** — the `linalg_mode` argument now accepts `CholInv`/`Inv`
(the replacement for the removed `calc_inv` option) and preconditioned sparse solvers
such as `sparseCGpre`/`sparseMINRESpre` for large gp2Scale problems.

## See Also

- [Repository](https://github.com/lbl-camera/gpCAM/)
Expand Down
609 changes: 410 additions & 199 deletions examples/1dSingleTaskAcqFuncTest.ipynb

Large diffs are not rendered by default.

85 changes: 67 additions & 18 deletions examples/GPOptimizer_Minimal.ipynb

Large diffs are not rendered by default.

177 changes: 81 additions & 96 deletions examples/GPOptimizer_MultiTaskTest.ipynb

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions examples/GPOptimizer_NonEuclideanInputSpaces.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "61c3f3bd",
"metadata": {},
"outputs": [],
"source": [
"# Install the newest version of gpcam\n",
"#!pip install gpcam==8.3.5"
"#!pip install gpcam==8.4.0"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "b5399565",
"metadata": {},
"outputs": [],
Expand All @@ -39,25 +39,25 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "b91e69d3",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/marcus/VirtualEnvironments/gpcam_dev/lib/python3.11/site-packages/fvgp/gp.py:310: UserWarning: No noise function or measurement noise provided. Noise variances will be set to (0.01 * mean(|y_data|))^2.\n",
"/home/marcus/Coding/fvGP/fvgp/gp.py:406: UserWarning: No noise function or measurement noise provided. Noise variances will be set to (0.01 * mean(|y_data|))^2.\n",
" self.likelihood = GPlikelihood(self.data,\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"hyperparameters: [49.31361296 26.90240104]\n",
"prediction : 2.0046357760678624\n",
"uncertainty: [0.97016186]\n"
"hyperparameters: [38.94724232 36.39665454]\n",
"prediction : 1.9934264485792332\n",
"uncertainty: [0.64431805]\n"
]
}
],
Expand Down Expand Up @@ -105,7 +105,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "a5644ec5",
"metadata": {},
"outputs": [
Expand All @@ -116,11 +116,11 @@
" ['who'],\n",
" ['be'],\n",
" ['it']], dtype='<U5'),\n",
" 'f_a(x)': array([0.82710967, 0.8218738 , 0.65115158, 0.43813236]),\n",
" 'f_a(x)': array([0.55032781, 0.54008504, 0.42359206, 0.29020021]),\n",
" 'opt_obj': None}"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -140,7 +140,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "f78b2e6b-68be-47f0-99db-82382eeb7944",
"metadata": {},
"outputs": [
Expand All @@ -166,7 +166,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "401a8d86-6205-4944-b9ed-e0397172b03f",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -197,7 +197,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"id": "19bccdab-1444-4dc4-bb44-dd88340f541e",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -235,7 +235,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"id": "a8b3c342-6829-42f7-bf9f-90cf3d9bf069",
"metadata": {},
"outputs": [
Expand All @@ -249,10 +249,10 @@
{
"data": {
"text/plain": [
"array([ 2.54827723, 15.05228436])"
"array([0.12880405, 9.12339126])"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -261,7 +261,7 @@
"my_gp2 = fvGPOptimizer(x_data,y_data,init_hyperparameters=np.ones((2)),\n",
" kernel_function=kernel\n",
" )\n",
"print(\"Global Training in progress\")\n",
"print(\"MCMC Training in progress\")\n",
"#use the next two lines if kernel `mkernel` is used\n",
"#if not a default deep kernel will be used that will set initi hyperparameters and bounds\n",
"#hps_bounds = np.array([[0.001,10000.],[1.,1000.]])\n",
Expand All @@ -273,18 +273,18 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"id": "b94b089a-332b-4c31-9535-2adb8ecd6f7a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'x': ['dwed', 'dwe'],\n",
" 'm(x)': array([[0.25466475, 0.25466475, 0.25466475, 0.25466475],\n",
" [0.29003775, 0.29003775, 0.29003775, 0.29003775]]),\n",
" 'm(x)_flat': array([0.25466475, 0.29003775, 0.25466475, 0.29003775, 0.25466475,\n",
" 0.29003775, 0.25466475, 0.29003775]),\n",
" 'm(x)': array([[0.53874768, 0.53874768, 0.53874768, 0.53874768],\n",
" [0.57401672, 0.57401672, 0.57401672, 0.57401672]]),\n",
" 'm(x)_flat': array([0.53874768, 0.57401672, 0.53874768, 0.57401672, 0.53874768,\n",
" 0.57401672, 0.53874768, 0.57401672]),\n",
" 'x_pred': [['dwed', np.int64(0)],\n",
" ['dwe', np.int64(0)],\n",
" ['dwed', np.int64(1)],\n",
Expand All @@ -295,7 +295,7 @@
" ['dwe', np.int64(3)]]}"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -307,7 +307,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"id": "0ca94f3f-452f-4173-a37b-22fae5ed9f19",
"metadata": {},
"outputs": [
Expand All @@ -318,11 +318,11 @@
" ['who'],\n",
" ['it'],\n",
" ['be']], dtype='<U5'),\n",
" 'f_a(x)': array([1.46161733, 0.72355182, 0.72355182, 0.28535747]),\n",
" 'f_a(x)': array([0.17396565, 0.0962287 , 0.0962287 , 0.05897216]),\n",
" 'opt_obj': None}"
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -364,7 +364,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.14"
"version": "3.11.15"
}
},
"nbformat": 4,
Expand Down
22 changes: 15 additions & 7 deletions examples/GPOptimizer_Optimization.ipynb

Large diffs are not rendered by default.

543 changes: 331 additions & 212 deletions examples/GPOptimizer_SingleTaskTest.ipynb

Large diffs are not rendered by default.

63 changes: 25 additions & 38 deletions examples/GPOptimizer_gp2ScaleTest.ipynb

Large diffs are not rendered by default.

34 changes: 2 additions & 32 deletions gpcam/autonomous_experimenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,6 @@ class AutonomousExperimenterGP:
newly suggested data points will be communicated. The default is False.
compute_device : str, optional
One of `cpu` or `gpu`, determines how linear algebra computations are executed. The default is `cpu`.
calc_inv : bool, optional
If True, the algorithm calculates and stores the inverse of the covariance
matrix after each training or update of the dataset or hyperparameters,
which makes computing the posterior covariance faster (3-10 times).
For larger problems (>2000 data points), the use of inversion should be avoided due
to computational instability and costs. The default is
False. Note, the training will not use the
inverse for stability reasons. Storing the inverse is
a good option when the dataset is not too large and the posterior covariance is heavily used.
Caution: this option, together with `append=True` in `tell()` will mean that the inverse of
the covariance is updated, not recomputed, which can lead to instability.
In application where data is appended many times, it is recommended to either turn
`calc_inv` off, or to regularly force the recomputation of the inverse via `gp_rank_n_update` in
`update_gp_data`.
training_dask_client : distributed.client.Client, optional
A Dask Distributed Client instance for distributed training. If None is provided, a new
`dask.distributed.Client` instance is constructed.
Expand Down Expand Up @@ -198,11 +184,10 @@ def __init__(self,
x_data=None, y_data=None, noise_variances=None, dataset=None,
communicate_full_dataset=False,
compute_device="cpu",
calc_inv=False,
training_dask_client=None,
acq_func_opt_dask_client=None,
gp2Scale=False,
gp2Scale_dask_client=None,
dask_client=None,
gp2Scale_batch_size=10000,
ram_economy=True,
args=None
Expand Down Expand Up @@ -337,20 +322,6 @@ class AutonomousExperimenterFvGP(AutonomousExperimenterGP):
newly suggested data points will be communicated. The default is False.
compute_device : str, optional
One of `cpu` or `gpu`, determines how linear algebra computations are executed. The default is `cpu`.
calc_inv : bool, optional
If True, the algorithm calculates and stores the inverse of the covariance
matrix after each training or update of the dataset or hyperparameters,
which makes computing the posterior covariance faster (3-10 times).
For larger problems (>2000 data points), the use of inversion should be avoided due
to computational instability and costs. The default is
False. Note, the training will not use the
inverse for stability reasons. Storing the inverse is
a good option when the dataset is not too large and the posterior covariance is heavily used.
Caution: this option, together with `append=True` in `tell()` will mean that the inverse of
the covariance is updated, not recomputed, which can lead to instability.
In application where data is appended many times, it is recommended to either turn
`calc_inv` off, or to regularly force the recomputation of the inverse via `gp_rank_n_update` in
`update_gp_data`.
training_dask_client : distributed.client.Client, optional
A Dask Distributed Client instance for distributed training. If None is provided, a new
`dask.distributed.Client` instance is constructed.
Expand Down Expand Up @@ -396,11 +367,10 @@ def __init__(self,
x_data=None, y_data=None, noise_variances=None, dataset=None,
communicate_full_dataset=False,
compute_device="cpu",
calc_inv=False,
training_dask_client=None,
acq_func_opt_dask_client=None,
gp2Scale=False,
gp2Scale_dask_client=None,
dask_client=None,
gp2Scale_batch_size=10000,
ram_economy=True,
args=None
Expand Down
Loading
Loading