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

Online phase tutorial #158

Merged
merged 58 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
285f1fd
Added Simple Solvers.
benedict-96 Jun 14, 2024
ec300a1
Merge branch 'main' into online_phase_tutorial
benedict-96 Jun 14, 2024
31c0704
Added references to relevant structs.
benedict-96 Jun 17, 2024
d153b01
Moved definition of losses to after architectures since we first need…
benedict-96 Jun 17, 2024
660c124
Added description of symplectic encoder and symplectic decoder.
benedict-96 Jun 17, 2024
0efa87e
Cleaned up existing docstrings a bit and added missing ones for Sympl…
benedict-96 Jun 17, 2024
d0931e6
Made addition between a skew-symmetric matrix and a standard matrix w…
benedict-96 Jun 17, 2024
80ffb52
Made addition between StiefelLieAlgHorMatrix and standard arrays work…
benedict-96 Jun 17, 2024
7bf4f86
Added ReducedLoss.
benedict-96 Jun 17, 2024
e44664a
Fixed problem which meant global section for the StiefelManifold didn…
benedict-96 Jun 17, 2024
3a3a52a
Added test for addition with an element of StiefelLieAlgHorMatrix.
benedict-96 Jun 17, 2024
b566565
Fixed script and using MakieCairo instead of Plots now.
benedict-96 Jun 17, 2024
b86c428
Updated script.
benedict-96 Jun 18, 2024
365c20d
Fixed integration with qp coordinates.
benedict-96 Jun 18, 2024
93b796b
Now using linear symplectic transformer.
benedict-96 Jun 18, 2024
9dd02db
Using the transformer for the integration step now.
benedict-96 Jun 19, 2024
a834845
Added a paragraph on how to perform the online phase with a neural ne…
benedict-96 Jun 19, 2024
6c9cd9c
Added CairoMakie.
benedict-96 Jun 19, 2024
89fdc79
Moved reduced order modeling section before architectures.
benedict-96 Jun 19, 2024
242120c
Added a tikz picture for the offline online phase.
benedict-96 Jun 19, 2024
8f57b2f
Now also exporting reduced loss.
benedict-96 Jun 19, 2024
7588c63
Expanded on the architecture a bit.
benedict-96 Jun 19, 2024
e412445
Turned this into a more general section on reduced order modeling.
benedict-96 Jun 19, 2024
d0ba50f
Improved readibility of docs.
benedict-96 Jun 19, 2024
4aad585
Put constructor at beginning of file.
benedict-96 Jun 19, 2024
4a53162
Added neural network losses.
benedict-96 Jun 19, 2024
6c1f0fe
Renamed file.
benedict-96 Jun 19, 2024
dce2f50
Implemented convenience constructors for the DataLoader that can be u…
benedict-96 Jun 21, 2024
1080f4d
Defined new constants for qp-type data.
benedict-96 Jun 21, 2024
c3b6a79
Also include the type now in definition of QPT and QPTOAT.
benedict-96 Jun 21, 2024
7fc97f8
Changed order in which files are included in order for gml to compile.
benedict-96 Jun 21, 2024
93f9fe4
Specified missing types.
benedict-96 Jun 21, 2024
b9d0080
Added info line (doctest not passing otherwise).
benedict-96 Jun 21, 2024
425ad4f
Added two more lines of text.
benedict-96 Jun 21, 2024
6ec0bc7
Also including the other sympnet layers in this file now.
benedict-96 Jun 26, 2024
cf9406e
Reworked the sympnet docs and moved the picture explaining the archit…
benedict-96 Jun 26, 2024
60c6a9c
Including bias layers at the points where they are needed.
benedict-96 Jun 26, 2024
14e3c59
Started reworking docstrings for sympnet architectures.
benedict-96 Jun 26, 2024
b86663e
Made SympNet theory bit better conform with docstrings etc.
benedict-96 Jun 27, 2024
a6561bc
GeometricMachineLearning.jl -> GeometricMachineLearning.
benedict-96 Jun 27, 2024
4767c04
Started adding tikz picture showing ingredients.
benedict-96 Jun 27, 2024
b313669
Added sentence on different losses.
benedict-96 Jun 27, 2024
2407345
Finished ingredients tikz.
benedict-96 Jun 27, 2024
1522324
Added PINN reference.
benedict-96 Jun 27, 2024
efb2037
Fixed include_graphics.
benedict-96 Jun 27, 2024
8f8626f
Implemented new routines to change the type in DataLoader.
benedict-96 Jun 27, 2024
b83f5ea
Got rid of 1.8 tests.
benedict-96 Jun 27, 2024
7c5e597
Fixed typos.
benedict-96 Jun 27, 2024
0dc73ab
Changed resolution of ingredients tikz.
benedict-96 Jun 27, 2024
1d1c081
Changed alpha value for better visibility.
benedict-96 Jun 27, 2024
be0e33c
Fixed problem with types (arguments were flipped.
benedict-96 Jun 27, 2024
18cd191
Restricted function further.
benedict-96 Jun 27, 2024
e1f97f9
Made transformer integrator work.
benedict-96 Jun 27, 2024
cdeaf42
Returning an error if a vector is provided as initial condition.
benedict-96 Jun 27, 2024
2f79261
Using QPTOAT for types now.
benedict-96 Jun 27, 2024
fc2990c
Removed Simple solvers.
benedict-96 Jun 27, 2024
48712e1
Merge branch 'main' into online_phase_tutorial
benedict-96 Jun 27, 2024
d991dac
Fix problem with curly braces.
benedict-96 Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8'
- '1.10'
- '^1.11.0-0'
os:
Expand Down
15 changes: 8 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,19 @@ makedocs(;
"BFGS Optimizer" => "optimizers/bfgs_optimizer.md",
],
"Special Neural Network Layers" => [
"Sympnet Gradient Layers" => "layers/sympnet_gradient.md",
"Sympnet Layers" => "layers/sympnet_gradient.md",
"Volume-Preserving Layers" => "layers/volume_preserving_feedforward.md",
"Attention" => "layers/attention_layer.md",
"Multihead Attention" => "layers/multihead_attention_layer.md",
"Linear Symplectic Attention" => "layers/linear_symplectic_attention.md",
],
"Reduced Order Modelling" =>[
"General Framework" => "reduced_order_modeling/reduced_order_modeling.md",
"Network Losses" => "reduced_order_modeling/losses.md",
"PSD and Symplectic Autoencoders" => "reduced_order_modeling/symplectic_autoencoder.md",
"Kolmogorov n-width" => "reduced_order_modeling/kolmogorov_n_width.md",
"Projection and Reduction Error" => "reduced_order_modeling/projection_reduction_errors.md",
],
"Architectures" => [
"Symplectic Autoencoders" => "architectures/symplectic_autoencoder.md",
"Neural Network Integrators" => "architectures/neural_network_integrators.md",
Expand All @@ -190,12 +197,6 @@ makedocs(;
"Routines" => "data_loader/data_loader.md",
"Snapshot matrix & tensor" => "data_loader/snapshot_matrix.md",
],
"Reduced Order Modelling" =>[
"POD and Autoencoders" => "reduced_order_modeling/autoencoder.md",
"PSD and Symplectic Autoencoders" => "reduced_order_modeling/symplectic_autoencoder.md",
"Kolmogorov n-width" => "reduced_order_modeling/kolmogorov_n_width.md",
"Projection and Reduction Error" => "reduced_order_modeling/projection_reduction_errors.md",
],
"Tutorials" =>[
"Sympnets" => "tutorials/sympnet_tutorial.md",
"Symplectic Autoencoders" => "tutorials/symplectic_autoencoder.md",
Expand Down
10 changes: 10 additions & 0 deletions docs/src/GeometricMachineLearning.bib
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,14 @@ @inproceedings{huang2016riemannian
pages={627--634},
year={2016},
organization={Springer}
}

@article{raissi2019physics,
title={Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations},
author={Raissi, Maziar and Perdikaris, Paris and Karniadakis, George E},
journal={Journal of Computational physics},
volume={378},
pages={686--707},
year={2019},
publisher={Elsevier}
}
74 changes: 66 additions & 8 deletions docs/src/architectures/symplectic_autoencoder.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,75 @@
# Symplectic Autoencoder

Symplectic autoencoders offer a structure-preserving way of mapping a high-dimensional system to a low dimensional system. Concretely this means that if we obtain a reduced system by means of a symplectic autoencoder, this system will again be reduced.

The architecture is represented by the figure below:

```@example
Main.include_graphics("../tikz/symplectic_autoencoder") # hide
```

It is a composition of [SympNet gradient layers](@ref "SympNet Gradient Layer") and PSD-like matrices.


## Intermediate Dimensions

For a high-fidelity system of dimension ``2N`` and a reduced system of dimension ``2n``, the intermediate dimensions in the symplectic encoder and the decoder are computed according to:

```julia
iterations = Vector{Int}(n : (N - n) ÷ (n_blocks - 1) : N)
iterations[end] = full_dim2
iterations * 2
```

So for e.g. ``2N = 100,`` ``2n = 10`` and ``\mathtt{n\_blocks} = 3`` we get

```math
\mathrm{iterations} = 5\mathtt{:}(45 \div 2)\mathtt{:}50 = 5\mathtt{:}22\mathtt{:}50 = (5, 27, 49),
```

and after the further two modifications the dimensions are:

```math
(10, 54, 100).
```


## Example

A visualization of an instance of [SymplecticAutoencoder](@ref) is shown below:

```@example
Main.include_graphics("../tikz/symplectic_autoencoder_architecture") # hide
```

The *intermediate dimension* ``M`` is calculated via `n : (N - n) ÷ (n_blocks - 1) : N`. Further we have the following choices:
- `n_encoder_layers::Integer = 4`
- `n_encoder_blocks::Integer = 2`
- `n_decoder_layers::Integer = 2`
- `n_decoder_blocks::Integer = 3`
- `encoder_init_q::Bool = true`
- `decoder_init_q::Bool = true`
In this example shown in the figure `n_encoder_blocks` is two, `n_encoder_layers` is four, `n_decoder_blocks` is 3 and `n_decoder_layers` is 2. You can build such an instance of a symplectic autoencoder by calling:

```@example sae
using GeometricMachineLearning

const full_dim = 100
const reduced_dim = 10

model = SymplecticAutoencoder(full_dim, reduced_dim; n_encoder_blocks = 2, n_encoder_layers = 4, n_decoder_blocks = 3, n_decoder_layers = 2)

for layer in Chain(model)
println(stdout, layer)
end
```

We also see that the intermediate dimension in the decoder is 54.

## Library Functions

```@docs; canonical = false
SymplecticAutoencoder
```

## References

```@bibliography
Pages = []
Canonical = false

Note that all of these are keyword arguments that can be supplied to [SymplecticAutoencoder](@ref).
brantner2023symplectic
```
Loading
Loading