# Learning Surrogates or Flux

**URL:** <https://discourse.julialang.org/t/learning-surrogates-or-flux/86457>\
**Category:** New to Julia\
**Tags:** machine-learning, simulations, modelling\
**Created:** [August 28, 2022, 11:50am UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457 "2022-08-28T11:50:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![davide445](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide445/32/33681_2.png) [@davide445](https://discourse.julialang.org/u/davide445)\
**Post date:** [August 28, 2022, 11:50am UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/1 "2022-08-28T11:50:42Z")

</div>

Proceeding trough my Julia learning I have a specific goal, produce a realtime surrogate of the complex soft body dynamics produced from packages such as [deal.ii](https://dealii.org/) or similar specialized FEM.  
This is just an example of deal.ii possible sim

[![](https://global.discourse-cdn.com/julialang/original/3X/c/1/c1615c17af300626dda8ce8cfab8a7519d06b570.jpeg "Poroviscoelastic simulation using deal.II") ](https://www.youtube.com/watch?v=1a4LbMXrnrs)

At this stage will use the FEM package as black box, so will not try to replicate the PDE solving in Julia.

My doubt is if will be better for me investing time in learning something such as Surrogates.jl (but need I to explicitly define the PDE?) or Flux to achieve my goal.

Or there is another approach I will be better consider.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [August 28, 2022, 2:03pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/2 "2022-08-28T14:03:41Z")

</div>

It depends on what you’re trying to do. Generally if you spend enough time with a deep neural network you can get something that’s a “little better”, but Surrogates.jl has a lot of the classic methods like GLKPLS that just kind of work without too much tweaking. They are different kinds of methods and which one you use depends on the situation.

> [@davide445](#):
>
> Or there is another approach I will be better consider.

We find reservoir computing approaches tend to be the most robust.

> **[GitHub - SciML/ReservoirComputing.jl: Reservoir computing utilities for...](https://github.com/SciML/ReservoirComputing.jl)**
>
> Reservoir computing utilities for scientific machine learning (SciML) - GitHub - SciML/ReservoirComputing.jl: Reservoir computing utilities for scientific machine learning (SciML)

---

<div class="post-metadata">

**Author:** ![davide445](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide445/32/33681_2.png) [@davide445](https://discourse.julialang.org/u/davide445)\
**Post date:** [August 28, 2022, 2:35pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/3 "2022-08-28T14:35:33Z")

</div>

So far learning this things, good and bads of various approaches, needed pipeline and their respective effort.  
At this stage seeing my learning path Surrogates\>Flux\>SciML in order of growing complexity and accuracy.  
SciML is probably what we will need.

---

<div class="post-metadata">

**Author:** ![davide445](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide445/32/33681_2.png) [@davide445](https://discourse.julialang.org/u/davide445)\
**Post date:** [September 4, 2022, 12:03pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/4 "2022-09-04T12:03:52Z")

</div>

Just to have an update maybe useful for others, due my need to create a surroge for multidimensional data I will be skip Surrogates, that’s really not focused on this kind of data, and directly go for Flux.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [September 4, 2022, 4:33pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/5 "2022-09-04T16:33:14Z")

</div>

It is. Not super high dimensional, but radial basis functions work well for tens or hundreds of dimensions

---

<div class="post-metadata">

**Author:** ![davide445](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide445/32/33681_2.png) [@davide445](https://discourse.julialang.org/u/davide445)\
**Post date:** [September 4, 2022, 5:22pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/6 "2022-09-04T17:22:39Z")

</div>

My data will be positions, velocity, acceleration of a set of hundred or thousand (for a prototype) of nodes in a mesh.  
A short contact with @ludoro get me the idea (maybe my fault) at his times was not a strong point of Surrogates dealing with this, but maybe has improved in the last couple of years and worth trying, I don’t know.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [September 4, 2022, 6:46pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/7 "2022-09-04T18:46:20Z")

</div>

> [@davide445](#):
>
> A short contact with @ludoro get me the idea (maybe my fault) at his times was not a strong point of Surrogates dealing with this, but maybe has improved in the last couple of years and worth trying, I don’t know.

Algorithmically, radial basis functions and such are fine with high dimensions. The original implementations were not, but more of the core package code for scaling has been replaced.

---

<div class="post-metadata">

**Author:** ![davide445](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davide445/32/33681_2.png) [@davide445](https://discourse.julialang.org/u/davide445)\
**Post date:** [September 4, 2022, 6:55pm UTC](https://discourse.julialang.org/t/learning-surrogates-or-flux/86457/8 "2022-09-04T18:55:06Z")

</div>

Thanks this changed the perspective of course and sure worth a try.  
I can so in the meantime sort out my Flux learning path, a bit stuck in JuliaAcademy notebooks.
