Skip to content

Commit c50362d

Browse files
committed
deprecate transform_to_real
1 parent f8f2e0e commit c50362d

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

src/Emulator.jl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,10 @@ function predict(
319319
emulator::Emulator{FT},
320320
new_inputs::AM;
321321
encode=nothing, # maps decoded inputs to decoded outputs
322+
add_obs_noise_cov=false,
322323
mlt_kwargs...,
323324
) where {FT <: AbstractFloat, AM <: AbstractMatrix}
325+
324326
# Check if the size of new_inputs is consistent with the training data input
325327
input_dim, output_dim = size(get_io_pairs(emulator), 1)
326328
encoded_input_dim, encoded_output_dim = size(get_encoded_io_pairs(emulator), 1)
@@ -443,6 +445,7 @@ function predict(
443445
fmw::FMW,
444446
new_inputs::AM;
445447
encode=nothing, # maps decoded inputs to decoded outputs
448+
add_obs_noise_cov=false,
446449
) where {FMW <: ForwardMapWrapper, AM <: AbstractMatrix}
447450
# Check if the size of new_inputs is consistent with the training input data
448451
input_dim, output_dim = size(get_io_pairs(fmw), 1)
@@ -514,4 +517,38 @@ function predict(
514517
end
515518
end
516519

520+
521+
### Deprecated keywords
522+
523+
function predict(
524+
em_or_fmw::EorFMW,
525+
new_inputs::AM;
526+
transform_to_real = nothing,
527+
kwargs...,
528+
) where {AM <: AbstractMatrix, EorFMW <: Union{Emulator, ForwardMapWrapper}}
529+
530+
if !isnothing(transform_to_real)
531+
Base.depwarn(
532+
"""`transform_to_real` keyword is deprecated. Please use the `encode` and `add_obs_noise_cov` keywords instead.
533+
534+
Recommended usage for users is now set by default as:
535+
- `encode=nothing`, `add_obs_noise_cov=false`
536+
This behaviour takes in non-encoded inputs, and returns non-encoded outputs. It gives only the uncertainty from the Machine Learning Tool (not inflated by observational noise)
537+
538+
This simulation will continue with the old behavior:
539+
- `transform_to_real=true` replaced with `encode=nothing, add_obs_noise_cov=true`
540+
- `transform_to_real=false` replaced with `encode="out", add_obs_noise_cov=true`
541+
""",
542+
:predict,
543+
)
544+
545+
# modify kwargs
546+
kw = Dict(kwargs)
547+
kw[:add_obs_noise_cov] = true
548+
kw[:encode] = transform_to_real ? nothing : "out"
549+
predict(em_or_fmw, new_inputs; kw...)
550+
end
551+
552+
return predict(em_or_fmw, new_inputs; kwargs...)
553+
517554
end

0 commit comments

Comments
 (0)