Skip to content

Conversation

sandreza
Copy link

Adds an emulate-sample example using a neural network and hamiltonian monte-carlo. Enzyme is used for autodiff. The example runs in about 2 minutes on a local laptop. This is done as a separate directory and is meant as a discussion point rather than user-friendly "emulate sample" framework (which would better go in the CalibrateEmulateSample package)

@sandreza sandreza requested review from glwagner and navidcy November 28, 2024 00:07
@glwagner
Copy link
Member

glwagner commented Dec 6, 2024

Does the example produce a posterior eestimate? What is it?

@sandreza
Copy link
Author

It produces the following figures:

UQ loss_fig

@glwagner
Copy link
Member

Epic! What do the bimodal results mean (parameters 1 and 5). Noise or something meaningful?

@sandreza
Copy link
Author

I think it's just noise. More sampling might suffice to get rid of it (or perhaps a better neural network surrogate). I don't expect this to be the "end" of the story, but rather a starting point for further work

@sandreza
Copy link
Author

Here it is with 100,000 samples:

UQ_1e5

@sandreza
Copy link
Author

and the regularization distribution (basically the prior)

regularization

@glwagner
Copy link
Member

How expensive is it? Can we experiment changing the prior/regularization distribution?

@sandreza
Copy link
Author

It runs in a few minutes. It's easy to change

@sandreza
Copy link
Author

The likelihood (no regularization)

Likellhood_1e5

@sandreza
Copy link
Author

Note that these are the marginal distributions as given by the neural network (we aren't see the higher order joint pdf structures with these figures

@glwagner
Copy link
Member

For reference I think these are the names of the parameters:

julia> eki.inverse_problem[1].free_parameters.names
(:CᵂwΔ, :Cᵂu★, :Cʰⁱc, :Cʰⁱu, :Cʰⁱe, :CʰⁱD, :Cˢ, :Cˡᵒc, :Cˡᵒu, :Cˡᵒe, :CˡᵒD, :CRi⁰, :CRiᵟ, :Cᵘⁿc, :Cᵘⁿu, :Cᵘⁿe, :CᵘⁿD, :Cᶜc, :Cᶜu, :Cᶜe, :CᶜD, :Cᵉc, :Cˢᵖ)

or

1 CᵂwΔ
2 Cᵂu★
3 Cʰⁱc
4 Cʰⁱu
5 Cʰⁱe
6 CʰⁱD
7 Cˢ
8 Cˡᵒc
9 Cˡᵒu
10 Cˡᵒe
11 CˡᵒD
12 CRi⁰
13 CRiᵟ
14 Cᵘⁿc
15 Cᵘⁿu
16 Cᵘⁿe
17 CᵘⁿD
18 Cᶜc
19 Cᶜu
20 Cᶜe
21 CᶜD
22 Cᵉc
23 Cˢᵖ

@glwagner
Copy link
Member

Couple thoughts: parameters 1 and 2 probably don't matter much. Parameter 10 (has to do with diffusivity of TKE for low Ri) seems sketch, since the prior is up against the upper bound. I'm surprised that parameters 8-9 are not more well constrained, I think they are crucial (along with 11) for shear mixing (together they determined the model's critical Ri). It's nice to see constraint on parameter 18, which controls tracer mixing during convection.

@sandreza
Copy link
Author

The updated plot now looks like the following for convenience:

Screen Shot 2024-12-11 at 12 24 37 PM

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.

2 participants