Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gaussian Random Field parameters #251

Closed
odunbar opened this issue Feb 15, 2023 · 1 comment
Closed

Gaussian Random Field parameters #251

odunbar opened this issue Feb 15, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request SDI

Comments

@odunbar
Copy link
Collaborator

odunbar commented Feb 15, 2023

This will enable parameters to be based in a function space, As a first stage we could look at representations using Gaussian Random Fields, using the package GaussianRandomFields.jl

@odunbar
Copy link
Collaborator Author

odunbar commented Mar 23, 2023

Still to do:

  • Check toml interface
  • Document Darcy example
  • Document GRF interface / parameter distribution
  • compatability with new plot features

@odunbar odunbar added enhancement New feature or request SDI labels Apr 13, 2023
bors bot added a commit that referenced this issue Apr 19, 2023
252: Add GaussianRandomFields to ParameterDistributions r=odunbar a=odunbar

<!--- THESE LINES ARE COMMENTED -->
## Purpose 
- Addresses #251  
This PR will enable users to learn parameters that are discretizations of functions. 

<!--- One sentence to describe the purpose of this PR, refer to any linked issues:
#14 -- this will link to issue 14
Closes #2 -- this will automatically close issue 2 on PR merge
-->

## Content
<!---  specific tasks that are currently complete 
- Solution implemented
-->
- Currently allows: ND -> 1D functions with zero-mean allowed, stored flat. 
- hierarchy: `GaussianRandomField <: FunctionParameterDistributionType <: ParameterDistributionType`
- We use the package `GaussianRandomFields.jl` as the back-end
- We provide a default for the prior coefficients distribution under-the-hood, when given a GRF. Otherwise we allow a user-defined coefficient parameter distribution
- When built as a `ParameterDistribution`, the user provides a single constraint and this constraint is applied to all discretization points when the function is constructed and constrained.
- Compatible with the transform mappings: for parameter distributions. E.g the default is now, given coefficients vector `x` in unconstrained space. `u->c ` will transform the unconstrained to constrained coefficients, then builds the unconstrained function, then constrains this function
- Docstrings
- Darcy Flow Example in `example/Darcy` Note: We generate truth and solve problem with efunction expansion.

### Plots from Tests
1D Samples of the default prior distribution based on `GRF(Matern(smooth. 1.0,corr. len. 0.1))`
![GRF_samples](https://user-images.githubusercontent.com/47412152/226429501-7c747e3a-3a99-431e-9e5b-25883913dda7.png)


A 2D sample with `bounded(-5,-3)` constraint
![GRF_samples_constrained](https://user-images.githubusercontent.com/47412152/225775099-a2368aba-061c-492b-bcd9-25545607a3b0.png)
The unconstrained 2D sample
![GRF_samples_unconstrained](https://user-images.githubusercontent.com/47412152/225775102-76411524-3b49-4e2b-bdcd-3d31c2e0481d.png)

### Results from Darcy Flow:
**Prior Mean**
![output_it_0](https://user-images.githubusercontent.com/47412152/226073056-1e356aee-06df-42e7-bec1-6c3a77febb3e.png)
**Final Ensemble Mean**
![output_it_10](https://user-images.githubusercontent.com/47412152/226073057-9b7cf60f-43f6-4701-b41a-550ecdb7bce7.png)
**Truth**
![output_true](https://user-images.githubusercontent.com/47412152/226073058-721ccbe1-83ec-4a61-a0f2-bb8c48c108ca.png)


<!---
Review checklist

I have:
- followed the codebase contribution guide: https://clima.github.io/ClimateMachine.jl/latest/Contributing/
- followed the style guide: https://clima.github.io/ClimateMachine.jl/latest/DevDocs/CodeStyle/
- followed the documentation policy: https://github.com/CliMA/policies/wiki/Documentation-Policy
- checked that this PR does not duplicate an open PR.

In the Content, I have included 
- relevant unit tests, and integration tests, 
- appropriate docstrings on all functions, structs, and modules, and included relevant documentation.

-->

----
- [x] I have read and checked the items on the review checklist.


Co-authored-by: odunbar <[email protected]>
@odunbar odunbar closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SDI
Projects
None yet
Development

No branches or pull requests

1 participant