Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
325 changes: 238 additions & 87 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GeometricMachineLearning"
uuid = "194d25b2-d3f5-49f0-af24-c124f4aa80cc"
version = "0.5.0-DEV"
version = "0.5.0"
authors = ["Michael Kraus <michael.kraus@ipp.mpg.de>"]

[deps]
Expand Down Expand Up @@ -41,7 +41,7 @@ ForwardDiff = "0.10, 1"
GeometricBase = "0.14"
GeometricEquations = "0.21"
GeometricIntegrators = "0.18.2"
GeometricOptimizers = "0.3"
GeometricOptimizers = "0.4"
GeometricSolutions = "0.6"
HDF5 = "0.16, 0.17"
KernelAbstractions = "0.9"
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ At its core every neural network comprises three components: a neural network ar

Traditionally, physical properties have been encoded into the loss function (PINN approach), but in `GeometricMachineLearning.jl` this is exclusively done through the architectures and the optimizers of the neural network, thus giving theoretical guarantees that these properties are actually preserved.

The optimizer methods themselves — `GradientMethod`, `MomentumMethod`, `Adam`, the manifold types they act on, and the caches, global sections and retractions that go with them — come from [`GeometricOptimizers.jl`](https://github.com/JuliaGNI/GeometricOptimizers.jl) and are re-exported here. `GeometricMachineLearning.jl` supplies the part that is specific to neural networks: the architectures, the layers, and walking the parameter tree of a network during training.

Using the package is very straightforward and is very flexible with respect to the device `(CPU, CUDA, Metal, ...)` and the type `(Float16, Float32, Float64, ...)` you want to use. The following is a simple example to learn a SympNet on data coming from a pendulum:
```julia
using GeometricMachineLearning
Expand All @@ -41,8 +43,8 @@ backend = CUDABackend()
# initialize the network (i.e. the parameters of the network)
g_nn = NeuralNetwork(gsympnet, backend, type)

# call the optimizer
g_opt = Optimizer(AdamOptimizer(), g_nn)
# call the optimizer: the method comes first, the step size is given separately
g_opt = Optimizer(Adam(type), g_nn; step_size = 1e-3)

const nepochs = 300
const batch_size = 100
Expand All @@ -53,7 +55,7 @@ g_loss_array = g_opt(g_nn, dl, Batch(batch_size), nepochs)
# plot the result
ics = (q=qp_data.q[:,1], p=qp_data.p[:,1])
const steps_to_plot = 200
g_trajectory = Iterate_Sympnet(g_nn, ics; n_points = steps_to_plot)
g_trajectory = iterate(g_nn, ics; n_points = steps_to_plot)
fig = Figure()
ax = Axis(fig[1, 1]; xlabel = "q", ylabel = "p")
lines!(ax, vec(qp_data.q')[1:steps_to_plot], vec(qp_data.p')[1:steps_to_plot]; label = "training data")
Expand Down
12 changes: 8 additions & 4 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ remove_numbering_for_some_chapters:
sed -i'' -e 's/\\section{Chapter Summary}/\\section*{Chapter Summary}/g' build/G*.tex;
sed -i'' -e 's/\\section{References}/\\section*{References}/g' build/G*.tex;

# `build/manifolds` and `build/optimizers/manifold_related` used to be listed here. Documenter only
# creates a `build/` subdirectory for a page tree that still has pages, so those two went away with
# the chapters that moved to GeometricOptimizers -- and `find` exits non-zero on a missing root,
# which aborts the recipe and takes the PDF workflow with it. The roots that remain are guarded for
# the same reason, so that the next chapter to move out does not break the build again.
copy_png_files:
find build/manifolds -name \*.png -exec cp {} build \; ;
find build/optimizers/manifold_related -name \*.png -exec cp {} build \; ;
find build/tutorials -name \*.png -exec cp {} build \;
find build/reduced_order_modeling -name \*.png -exec cp {} build \;
for d in tutorials reduced_order_modeling; do \
if [ -d "build/$$d" ]; then find "build/$$d" -name \*.png -exec cp {} build \; ; fi; \
done

docstring_indexing:
sed -i'' -e 's/\\item \\hyperlinkref{\([0-9]*\)}{\\texttt{\(.*\)}}/\\item \\hyperlinkref{\1}{\\texttt{\2}}: page \\pageref{\1}/g' build/G*.tex;
Expand Down
6 changes: 3 additions & 3 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ AbstractNeuralNetworks = "60874f82-5ada-4c70-bd1c-fa6be7711c8a"
Bibliography = "f1be7e48-bf82-45af-a471-ae754a193061"
BrenierTwoFluid = "698bc5df-bacc-4e45-9592-41ae9e406d75"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DocInventories = "43dc2714-ed3b-44b5-b226-857eda1aa7de"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
GeometricIntegrators = "dcce2d33-59f6-5b8d-9047-0defad88ae06"
GeometricMachineLearning = "194d25b2-d3f5-49f0-af24-c124f4aa80cc"
Expand All @@ -14,8 +16,6 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

# GeometricMachineLearning itself is deliberately *not* listed here: `docs/Makefile`'s `test_docs`
# target develops it from the repository root, which is what makes the same file work in CI and in a
# local clone at any path.
[sources]
BrenierTwoFluid = {rev = "main", url = "https://github.com/ToBlick/BrenierTwoFluids.git"}
GeometricMachineLearning = {path = ".."}
Loading
Loading