Skip to content

Commit 6d1b6df

Browse files
committed
Update docs and examples; use semicolon notation for named tuples
1 parent 87b2e6d commit 6d1b6df

File tree

19 files changed

+51
-82
lines changed

19 files changed

+51
-82
lines changed

docs/src/data_processing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ complex_schedule = [
2828
In this (rather unrealistic) chain;
2929
1. The inputs are decorrelated with their sample mean and covariance (and projected to low dimensional subspace if necessary) i.e PCA
3030
2. The scaled inputs are then subject to a "Robust" univariate scaling, mapping 1st-3rd quartiles to [0,1]
31-
3. The outputs are decorrelated using an "output structure matrix" (provided to the emulator `output_structure_matrix=`). Furthermore, apply a dimension-reduction to a space that retains 95% of the total variance.
31+
3. The outputs are decorrelated using an "output structure matrix" (provided to the emulator in the `encoder_kwargs` parameter, e.g. as `(; obs_cov_noise =)`). Furthermore, apply a dimension-reduction to a space that retains 95% of the total variance.
3232
4. In the reduced input-output space, a canonical correlation analysis is performed. Data is oriented and reduced (if necessary) maximize the joint correlation between inputs and outputs.
3333

3434
!!! note "Default Encoder schedule"
@@ -44,12 +44,12 @@ The schedule is then passed into the Emulator, along with the data and desired s
4444
```julia
4545
emulator = Emulator(
4646
machine_learning_tool,
47-
input_output_pairs;
48-
output_structure_matrix = obs_noise_cov,
47+
input_output_pairs,
48+
(; obs_noise_cov = obs_noise_cov);
4949
encoder_schedule = complex_schedule,
5050
)
5151
```
52-
Note that due to the item `(decorrelate_structure_mat(retain_var=0.95), "out")` in the schedule, we must provide the `output_structure_matrix`.
52+
Note that due to the item `(decorrelate_structure_mat(retain_var=0.95), "out")` in the schedule, we must provide an output structure matrix. In this case, we provide `obs_noise_cov`.
5353

5454
# Types of data processors
5555

docs/src/emulate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Wrapping a predefined machine learning tool, e.g. a Gaussian process `gauss_proc
1616
```julia
1717
emulator = Emulator(
1818
gauss_proc,
19-
input_output_pairs; # optional arguments after this
20-
output_structure_matrix = Γy,
19+
input_output_pairs,
20+
(; obs_noise_cov = Γy); # optional arguments after this
2121
encoder_schedule = encoder_schedule,
2222
)
2323
```

examples/Cloudy/Cloudy_emulate_sample.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,8 @@ function main()
171171
# build emulator
172172
emulator = Emulator(
173173
mlt,
174-
input_output_pairs;
175-
input_structure_matrix = cov(priors),
176-
output_structure_matrix = Γy,
174+
input_output_pairs,
175+
(; prior_cov = cov(priors), obs_noise_cov = Γy);
177176
encoder_schedule = encoder_schedule,
178177
)
179178

examples/Darcy/emulate_sample.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ function main()
9696

9797
emulator = Emulator(
9898
mlt,
99-
input_output_pairs;
100-
input_structure_matrix = cov(prior),
101-
output_structure_matrix = Γy,
99+
input_output_pairs,
100+
(; prior_cov = cov(prior), obs_noise_cov = Γy);
102101
encoding_schedule = encoding_schedule,
103102
)
104103
optimize_hyperparameters!(emulator, kernbounds = [fill(-1e2, n_params + 1), fill(1e2, n_params + 1)])

examples/EDMF_data/emulator-rank-test.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,8 @@ function main()
256256
ttt[rank_id, rep_idx] = @elapsed begin
257257
emulator = Emulator(
258258
mlt,
259-
train_pairs;
260-
input_structure_matrix = cov(prior),
261-
output_structure_matrix = truth_cov,
259+
train_pairs,
260+
(; prior_cov = cov(prior), obs_noise_cov = truth_cov);
262261
encoder_schedule = encoder_schedule,
263262
)
264263

examples/EDMF_data/uq_for_edmf.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ function main()
230230
# Fit an emulator to the data
231231
emulator = Emulator(
232232
mlt,
233-
input_output_pairs;
234-
input_structure_matrix = cov(prior),
235-
output_structure_matrix = truth_cov,
233+
input_output_pairs,
234+
(; prior_cov = cov(prior), obs_noise_cov = truth_cov);
236235
encoder_schedule = encoder_schedule,
237236
)
238237

examples/Emulator/G-function/emulate-test-n-features.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,8 @@ function main()
151151

152152
# Emulate
153153
ttt[f_idx, rep_idx] = @elapsed begin
154-
emulator = Emulator(
155-
mlt,
156-
iopairs;
157-
output_structure_matrix = Γ * I,
158-
encoder_schedule = deepcopy(encoder_schedule),
159-
)
154+
emulator =
155+
Emulator(mlt, iopairs, (; obs_noise_cov = Γ * I); encoder_schedule = deepcopy(encoder_schedule))
160156
optimize_hyperparameters!(emulator)
161157
end
162158

examples/Emulator/G-function/emulate.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,7 @@ function main()
142142

143143
# Emulate
144144
times[rep_idx] = @elapsed begin
145-
emulator = Emulator(
146-
mlt,
147-
iopairs;
148-
output_structure_matrix = Γ * I,
149-
encoder_schedule = deepcopy(encoder_schedule),
150-
)
145+
emulator = Emulator(mlt, iopairs, (; obs_noise_cov = Γ * I); encoder_schedule = deepcopy(encoder_schedule))
151146
optimize_hyperparameters!(emulator)
152147
end
153148

examples/Emulator/Ishigami/emulate.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ function main()
123123
end
124124

125125
# Emulate
126-
emulator =
127-
Emulator(mlt, iopairs; output_structure_matrix = Γ * I, encoder_schedule = deepcopy(encoder_schedule))
126+
emulator = Emulator(mlt, iopairs, (; obs_noise_cov = Γ * I); encoder_schedule = deepcopy(encoder_schedule))
128127
optimize_hyperparameters!(emulator)
129128

130129
# get EKP errors - just stored in "optimizer" box for now

examples/Emulator/L63/emulate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function main()
215215
else
216216
encoder_schedule = (decorrelate_structure_mat(), "out")
217217
end
218-
emulator = Emulator(mlt, iopairs; output_structure_matrix = Γy, encoder_schedule = deepcopy(encoder_schedule))
218+
emulator = Emulator(mlt, iopairs, (; obs_noise_cov = Γy); encoder_schedule = deepcopy(encoder_schedule))
219219
optimize_hyperparameters!(emulator)
220220

221221
# diagnostics

0 commit comments

Comments
 (0)