Emulators

Typically, emulators are instantiated this way:

emulate:
  # Specify the emulator class
  class: cosmofit.emulators.TaylorEmulator
  init:
    # Any emulator option
  sample:
    # Any option specifying how to sample the pipeline to emulate
    # Or path to samples (e.g. MCMC chains or grid) to use
  fit:
    # Any option to fit the pipeline to emulate
  check:
    # Any option to check emulation is reliable
  plot:
    # Path to plot(s) of predicted vs. true emulated quantities
  # Where to save emulator
  # Then, the calculator up to which the pipeline has been emulated
  # can be loaded with load: emulator.npy
  save: emulator.npy

One will typically run pipeline sampling in parallel. In the following we present emulators’ default options (in addition to those presented above).

mlp

class: MLPEmulator

info:
  version: 0.0.1
  date: 05/04/2022
  maintainer: Arnaud de Mattia
  description: Wrapper for MLP emulator
  url: https://github.com/sfschen/EmulateLSS
  doi:
  long_description: Based on Joe DeRose and Stephen Chen's EmulateLSS code

init:
  # Number of hidden layers
  nhidden: [100, 100, 100]
  # Transform to be applied to quantity to be emulated
  # One can pass arcsinhoptimizer='adam', validation_frac=0.2, batch_sizes=(320, 640, 1280, 2560, 5120), epochs=1000, learning_rates=(1e-2, 1e-3, 1e-4, 1e-5, 1e-6), seed=None
  ytransform: ''

fit:
  # Fraction of the training sample to use for validation
  validation_frac: 0.2
  # Tensorflow optimizer to use
  optimizer: 'adam'
  # Optimization batch sizes
  batch_sizes: [320, 640, 1280, 2560, 5120]
  # Number of optimization epochs or a list of such number for each batch
  epochs: 1000
  # Learning rate, a float or a list of such float for each batch
  learning_rates: [1e-2, 1e-3, 1e-4, 1e-5, 1e-6]
  # Random seed
  seed: None

taylor

class: TaylorEmulator

info:
  version: 0.0.1
  date: 05/04/2022
  maintainer: Arnaud de Mattia
  description: Wrapper for Taylor emulator
  url: https://github.com/cosmodesi/desi-y1-kp45/tree/main/ShapeFit_Velocileptors
  doi:
  long_description: Based on Stephen Chen and Mark Maus' velocileptors' Taylor expansion

init:
  # The derivative order
  # One can pass a dictionary of parameter name (including wildcard) and integers,
  # e.g. {param*: 3, param1: 2}
  order: 4
  # The accuracy order, by default 2, i.e. O(dx^2)
  accuracy: 2

sample:
  # Max parameter intervals correspond to width of reference distribution, scaled by this factor
  ref_scale: 1e-1