andy-iskauskas / hmer

An R package for Bayes Linear emulation and history matching.
Other
16 stars 3 forks source link

Local objects in custom emulators #8

Closed tjmckinley closed 1 year ago

tjmckinley commented 1 year ago

Hey man,

Here is an attempt to allow additional arguments to be included in custom emulator and implausibility functions.

I've attached a reprex below. The only issue that still remains is the change of cutoff when sampling new points. I currently amend L496 of genpoints.R to read:

cutoff_current <- cutoff

but I'm not sure if this has any further consequences?

wave1.zip

The downside of this is that you can't use the self$ reference in your custom implausibility function (in the same way that you can't for the custom predf and varf functions either). In the attached example I fit a GP, and then include this as an additional object em when Proto_emulator() is run. All additional arguments to any function passed to Proto_emulator() must then be passed in as additional arguments when building the custom emulator, and these are all checked each time one of these functions is run (so should throw an error if some arguments are missing).

See what you think?

Cheers,

T

P.S. I haven't updated the examples in the documentation - I only made rudimentary changes.