# FunctionalChaosAlgorithm with your own orthonormal basis construction

**URL:** <https://openturns.discourse.group/t/functionalchaosalgorithm-with-your-own-orthonormal-basis-construction/143>\
**Category:** Python usage\
**Tags:** polynomial-chaos\
**Created:** [June 1, 2021, 10:23am UTC](https://openturns.discourse.group/t/functionalchaosalgorithm-with-your-own-orthonormal-basis-construction/143 "2021-06-01T10:23:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcoelho](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lcoelho](https://openturns.discourse.group/u/lcoelho)\
**Post date:** [June 1, 2021, 10:23am UTC](https://openturns.discourse.group/t/functionalchaosalgorithm-with-your-own-orthonormal-basis-construction/143/1 "2021-06-01T10:23:55Z")

</div>

Hi,

Using `ot.FunctionalChaosAlgorithm()`, I would like to know if it’s possible to give your own construction of the orthonormal basis in the `AdaptativeStrategy()`.  
 ![fourier_chaos](https://global.discourse-cdn.com/free1/uploads/openturns/original/1X/3d1b893f446a3c6aa9a47f04cf4b2da4bf38080a.png)

Best,  
Ludovic

---

<div class="post-metadata">

**Author:** ![regislebrun](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/regislebrun/32/154_2.png) [@regislebrun](https://openturns.discourse.group/u/regislebrun)\
**Post date:** [June 1, 2021, 7:32pm UTC](https://openturns.discourse.group/t/functionalchaosalgorithm-with-your-own-orthonormal-basis-construction/143/2 "2021-06-01T19:32:39Z")

</div>

Hi,

Unless you code it in C++, there is no way to define your own orthonormal basis in Python. Nevertheless, you have some capabilities which may help you:

- The `FourierSeriesFactory` class allows to build the Fourier orthonormal chaos wrt the Uniform(-1,1) distribution, which can be used with any uniform distribution as `FunctionalChaosAlgorithm` will build the affine transformation to map it into the Uniform(-1,1) distribution for you.
- The `StandardDistributionPolynomialFactory` class allows to build the orthonormal polynomial basis for any discrete or continuous 1D distribution if it has finite moments of any order. Beware of the fact that the distribution has to be uniquely defined by its moment to get an Hilbert basis this way. For example, the orthonormal polynomials associated to a LogNormal distribution will not allow to approximate all the possible functions, e.g. x-\>1/x

Cheers

Régis

---

<div class="post-metadata">

**Author:** ![MichaelBaudin](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/michaelbaudin/32/9_2.png) [@MichaelBaudin](https://openturns.discourse.group/u/MichaelBaudin)\
**Post date:** [September 15, 2022, 1:29pm UTC](https://openturns.discourse.group/t/functionalchaosalgorithm-with-your-own-orthonormal-basis-construction/143/3 "2022-09-15T13:29:42Z")

</div>

Hi,  
If the distribution which is associated to the orthonormal basis is known, it can be defined in Python using the [PythonDistribution](https://openturns.github.io/openturns/master/user_manual/_generated/openturns.PythonDistribution.html). Then `StandardDistributionPolynomialFactory` creates the orthonormal basis from the distribution using the modified Stieljes algorithm (an improved Gram-Schmidt method).  
But I do not think that this fits your need, because you do not have such a distribution isn’it?  
Regards,  
Michaël
