Skip to content

Commit e0470a9

Browse files
committed
resolve review
1 parent 7393064 commit e0470a9

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

src/Emulator.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ Positional Arguments
479479
Keyword Arguments
480480
- `encoder_schedule`[=`nothing`]: the schedule of data encoding/decoding. This will be passed into the method `create_encoder_schedule` internally. `nothing` sets sets a default schedule `[(decorrelate_sample_cov(), "in_and_out")]`, or `[(decorrelate_sample_cov(), "in"), (decorrelate_structure_mat(), "out")]` if an `encoder_kwargs` has a key `:obs_noise_cov`. Pass `[]` for no encoding.
481481
- `encoder_kwargs`[=`NamedTuple()`]: a Dict or NamedTuple with keyword arguments to be passed to `initialize_and_encode_with_schedule!`
482-
- `noise_injector_threshold`[=`0.001`]: A threshold to implementing noise boosting when decoding from an lossily encoded space. If the variance loss due to encoding is `>noise_injector_threshold` then additional noise is added to the null-space (consistent with the prior correlation structure).
482+
- `noise_injector_threshold`[=`0.001`]: A threshold to implementing noise injection when decoding from an lossily encoded space. If the variance loss due to encoding is `>noise_injector_threshold` then additional noise is added to the null-space (consistent with the prior correlation structure).
483+
- `noise_injector_scaling`[=`1.0`]: a multiplicative scaling that is applied to injected noise samples. (1.0 is "consistent" with Gaussian theory, but may cause instability in Non-Gaussian problems and can be reduced)
483484
"""
484485
function forward_map_wrapper(
485486
forward_map::Function,
@@ -488,7 +489,7 @@ function forward_map_wrapper(
488489
encoder_schedule = nothing,
489490
encoder_kwargs = NamedTuple(),
490491
noise_injector_threshold = 0.001,
491-
noise_injector_scaling = 0.1,
492+
noise_injector_scaling = 1.0,
492493
) where {FT <: Real, PD <: ParameterDistribution}
493494

494495
# Default processing: decorrelate_sample_cov() where no structure matrix provided, and decorrelate_structure_mat() where provided.

src/MarkovChainMonteCarlo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ $(DocStringExtensions.TYPEDSIGNATURES)
817817
Returns a `ParameterDistribution` object corresponding to the empirical distribution of the
818818
samples in `chain`.
819819
820-
keywod args
820+
keyword args
821821
- `noise_injector_threshold`[`=0.001`]: If the encoded space is lossy, and the lost variability due to encoding exceeds a threshold `noise_injector_threshold`, then in place of decoding posterior samples, additional noise consistent with the prior is injected into the null space of the encoder. See `decode_and_add_noise()` for more detail.
822822
- `noise_injector_scaling`[`=1.0`]: Scales the injected noise; though 1.0 is the only "consistent" value, reduction may be necessary if noise injection causes posterior samples to be unstable in simulations.
823823

src/Utilities.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,9 @@ struct NoiseInjector{
867867
L::NorMM
868868
"Scale the noise (may be needed (<1.0) for robustness if samples will be run in a physical model)"
869869
scaling::FT
870-
"whether to use the encoding or not"
870+
"whether to use the noise injection or not"
871871
use_noise::Bool
872-
"the encoding that was used to construct this"
872+
"the encoding that was used to construct this object"
873873
encoder_schedule::VV
874874
end
875875

@@ -934,13 +934,15 @@ function decode_and_add_noise(
934934
return samples
935935
end
936936

937-
K, enc_m, m, L, scaling, use_noise, encoder_schedule = noise_injector.K,
938-
noise_injector.enc_m,
939-
noise_injector.m,
940-
noise_injector.L,
941-
noise_injector.scaling,
942-
noise_injector.use_noise,
943-
noise_injector.encoder_schedule
937+
(K, enc_m, m, L, scaling, use_noise, encoder_schedule) = (
938+
noise_injector.K,
939+
noise_injector.enc_m,
940+
noise_injector.m,
941+
noise_injector.L,
942+
noise_injector.scaling,
943+
noise_injector.use_noise,
944+
noise_injector.encoder_schedule,
945+
)
944946

945947
if use_noise
946948
recovered_samples = m .+ K * (samples .- enc_m)

0 commit comments

Comments
 (0)