Hi Flore! If I understand your problem correctly, I see 2 ways of tackling it. One is theoretically grounded, but requires you to code your own covariance kernel, and only works with Kriging. The other is easier and works with both any metamodel, but is essentially a hack.
Kriging: mathematically sound method
To do this properly with a Kriging algorithm, you essentially need to use a covariance kernel defined on the unit circle.
The problem is, no such kernel is currently implemented in OpenTURNS. However, you can build it yourself (in OpenTURNS, not Persalys unfortunately).
Following Padonou and Roustant (2016), we can for example compose a Wendland function with the geodesic distance on the unit sphere to produce such a kernel (see pages 7 and 8 in the article):
import openturns as ot
from math import pi
geodesic_distance = ot.SymbolicFunction('theta', 'acos(cos(theta))')
wendland_function = ot.SymbolicFunction('t', '(1 + 4t) * max(0, 1 - t)^4') # c = 1, tau = 4
rho = ot.ComposedFunction(wendland_function, geodesic_distance)
cov = ot.StationaryFunctionalCovarianceModel([360 / 2 / pi], [1.0], rho)
Note that you cannot compose any covariance kernel on the real line with the geodesic distance to get a proper kernel for the unit circle! It must have specific properties which are given in the article, but the Wendland function above has them.
Here is what the covariance function looks like:
cov.draw(0, 0, 0.0, 600.0, 1000)
As you can see, it it is periodic and its period length is 360.
Be careful however, if you use this kernel, you cannot allow the Kriging hyperparameter optimization algorithm to estimate the length scale of cov
, otherwise the period length will change. Since the length scale is parameter #0 and the amplitude is parameter #1, you can disable length scale estimation with:
cov.setActiveParameter([1]) # only the amplitude will be estimated
Kriging and PCE : easy method
An easier, but mathematically ungrounded method, would be to replicate your dataset on several periods before training the Kriging / PCE algorithm.
For example, you could create a copy of your dataset with input values in the range [-360, 0], and another in the range [360, 720]. And then train the Kriging / PCE metamodel on the “augmented” dataset with input range [-360, 720], even if in the end you only use the metamodel on the [0, 360] range.
If you do this, you can of course use either OpenTURNS or Persalys.