Skip to content

Replacement of Emulator processing with new encoding framework - #367

Merged
odunbar merged 76 commits into
mainfrom
orad/migrate-data-proc-to-new
Jul 15, 2025
Merged

Replacement of Emulator processing with new encoding framework#367
odunbar merged 76 commits into
mainfrom
orad/migrate-data-proc-to-new

Conversation

@odunbar

@odunbar odunbar commented Jun 25, 2025

Copy link
Copy Markdown
Member

Purpose

Closes #365

  • Additional notes: The RF training is surprisingly sensitive to the processing, possibly priors for optimization? [UPDATE: Seems like it is not really the processing but has issues even without it]

Content

  • Added the interface to use the encoder processors (else an empty processor, or don't provide one)
  • Created a default that will decorrelate data, and use structure mat where possible
# if output_structure_matrix provided, but input not. 
# Default = 
encoder_schedule = [
     (decorrelate_sample_cov(), "in"),
     (decorrelate_structure_mat(), "out"),
]
  • Replaced the encoding/decoding in the MCMC too
  • Removed all the redundant old code that performed normalization etc.
  • Add new ScalarRandomFeature and GaussianProcess regularization that can handle a diagonal but non-identity noise covariance - diagnosed from an output covariance if provided.
  • Replaced in examples as below:
    • Emulators/Regression_2d_2d/
    • Emulators/Ishigami/
    • Emulators/G-function/
    • Emulators/L63/
    • Sinusoid/
    • Lorenz/ (and "Lorenz spatial dep")
    • Darcy/
    • Cloudy/
    • EDMF_data/ - not validated results
    • GCM/ - not validated results
  • Updated all unit tests
  • Added an initial documentation page

Misc

Replacement pattern in examples:

Before:

decorrelate = true # or false
Emulator(mlt, io_pairs; obs_noise_cov = A, decorrelate = bool1, standardize = bool2, retain_svd_frac=frac)

Replaced with something like

using CalibrateEmulateSample.Utilities
# examples..
encoder_schedule = nothing # default
encoder_schedule = [] # no processing
encoder_schedule = (decorrelate_structure_mat(retain_var = frac), "out")


Emulator(mlt, io_pairs; input_structure_matrix = A_in, output_structure_matrix = A_out, encoder_schedule = deepcopy(encoder_schedule) )

or with

Emulator(mlt, io_pairs; output_structure_matrix = A, encoder_schedule = deepcopy(encoder_schedule) )

Example of R2->R2 regression (GP-SKL) from 200 points

Currently no encoder performas similarly to encoding in this simple problem. The task is to Reconstruct the 2D outputs from training data shown (under dim1<->dim2 correlated by noise):

A few of the cases we have:

No processing (no-proc): mean and variance of prediction

Whiten with noise/prior struct-mat: mean and variance of prediction

Whiten then apply CCA whiten-then-cca: mean and variance of prediction

Example of Lorenz/emulate_sample_spatial_dep.jl

UQ with GP, and using the retain_var = 0.95, reduces R40->R80 map to R19->R40


  • I have read and checked the items on the review checklist.

@ArneBouillon

Copy link
Copy Markdown
Collaborator

Are mutable structs an option for you?

@odunbar

odunbar commented Jul 7, 2025

Copy link
Copy Markdown
Member Author

Unsure, I was told to not use them (a verry long time ago) but have not revisited. I think it is something that could be discussed at a later time however. Thanks for raising the question though and should not be horrible to change given we are adding more API for these structs

@odunbar
odunbar requested a review from ArneBouillon July 11, 2025 22:02

@ArneBouillon ArneBouillon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commits since my merge look sensible to me :)

@odunbar
odunbar merged commit a318edb into main Jul 15, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from old standardization/normalization framework to the data processing utilities in a seamless fashion

2 participants