aai-institute / continuiti

Learning function operators with neural networks.
GNU Lesser General Public License v3.0
17 stars 3 forks source link

FunctionSet should support more functionality to easily sample parameterised functions #132

Open samuelburbulla opened 3 months ago

samuelburbulla commented 3 months ago

Currently, we have sth. like

num_functions = 100
degree = 3

space = FunctionSet(lambda a: lambda x: 
     sum(a[i] * x**i for i in range(degree + 1))
 )
coeffs = torch.randn(degree + 1, num_functions)
poly = space(coeffs)                                                 
u = torch.stack([p(x) for p in poly])

In DeepXDE, the same code is:

space = dde.data.PowerSeries(N=degree + 1)
coeffs = space.random(num_functions)
u = space.eval_batch(coeffs, x)

We should introduce the following functionality:

Maybe it makes sense to rename FunctionSet to FunctionSpace then (as in DeepXDE) that holds the mathematical description of the parametric function space, and use the name FunctionSet for the object that holds the list of functions already evaluated at a set of coefficients.