Hi Regis,

Thanks for your reply.

I am using the same script from this conversation.
I enclosed it again.

Sincerely,

Pamphile

import openturns as ot
import numpy as np
from memory_profiler import profile

ot.ResourceMap.SetAsUnsignedInteger("DesignProxy-DefaultCacheSize", 0)

# The model
x1 = ot.Uniform(15., 60.)
x2 = ot.Normal(4035., 400.)
dists = [x1, x2]

# The model
model = ot.SymbolicFunction(["x", "y"], ["sin(x) / (1.0 + y * y)"] * 14)

# The distribution and the associated multivariate polynomial basis
marginals = [ot.Exponential(2.0), ot.Normal(-1.0, 0.5)]
dimension = len(marginals)
distribution = ot.ComposedDistribution(marginals)
enumerateFunction = ot.EnumerateFunction(dimension)
basis = ot.OrthogonalProductPolynomialFactory(
    [ot.StandardDistributionPolynomialFactory(ot.AdaptiveStieltjesAlgorithm(margin))
     for margin in marginals], enumerateFunction)
measure = basis.getMeasure()

# The Functional Chaos details...
deg = 10
degrees = [deg + 1] * dimension
projectionStrategy = ot.IntegrationStrategy(ot.GaussProductExperiment(measure, degrees))
adaptiveStrategy = ot.FixedStrategy(basis, enumerateFunction.getStrataCumulatedCardinal(deg))

# Generate the input sample WITH THE ASSOCIATED WEIGTHS
inputSample, weights = projectionStrategy.getExperiment().generateWithWeights()

# Evaluate the model
outputSample = np.array(model(inputSample))


@profile
def model_fitting(column):
    column = column.reshape((-1, 1))

    pc_algo = ot.FunctionalChaosAlgorithm(inputSample, weights, column,
                                          distribution, adaptiveStrategy,
                                          projectionStrategy)
    ot.Log.Show(ot.Log.ERROR)
    pc_algo.run()
    pc_result = pc_algo.getResult()
    pc = pc_result.getMetaModel()
    return pc, pc_result


results = [model_fitting(out) for out in outputSample.T]

Le 29 nov. 2017 à 08:15, regis lebrun <[email protected]> a écrit :

Hi Pamphile,

Could you please provide us a script that reproduce the error? It looks very strange, as this class is tested in more than 10 unit tests and is extensively used in industrial studies. BTW, ot.ComposedDistribution is by no means restricted to the independent copula as your comment could suggest.

Please note that it is not the physical space distribution which is checked by the GaussProductExperiment class, 
but the distribution defining the functional basis. You should use either OrthogonalProductPolynomialFactory or OrthogonalProductFunctionFactory to build your multivariate basis from 1D orthogonal bases to insure that the resulting multivariate distribution has an independent copula.

Please give me a feedback on this problem ASAP.

Cheer

Régis


Le mardi 28 novembre 2017 à 23:01:53 UTC+1, roy <[email protected]> a écrit :


Hi Regis,

On the 1.10, I get this error calling the FunctionalChaosAlgorithm:

  File "/Users/roy/Applications/miniconda3/envs/batman3/lib/python3.6/site-packages/openturns/metamodel.py", line 3849, in __init__
    this = _metamodel.new_FunctionalChaosAlgorithm(*args)
TypeError: InvalidArgumentException : Error: the GaussProductExperiment can only be used with distributions having an independent copula.

But this was working on 1.9. I do not understand the issue as the distribution is an ot.ComposedDistribution. I tried to explicitly add ot.IndependentCopula
without any change.

Thanks in advance,


Pamphile ROY
Chercheur doctorant en Quantification d’Incertitudes
CERFACS - Toulouse (31) - France
+33 (0) 5 61 19 31 57
+33 (0) 7 86 43 24 22


_______________________________________________
OpenTURNS users mailing list
[email protected]
http://openturns.org/mailman/listinfo/users

Reply via email to