Hello,
I've been trying to recreate the example in the user cases manual on
creating a PCE model from a design experiment ( section 4.3.4) but I am
getting an error:
return _metamodel.FunctionalChaosAlgorithm_run(self)
*TypeError: InvalidArgumentException : Error: the left gradient and the
right function have incompatible input or output dimensions.*
The code I am using is given below and I am using OT 1.11. Does anyone
have any idea what can be the problem?
Many thanks for the help,
Armando
from math import sin, pi
import openturns as ot
# Definition of the Ishigami function
dimension = 3
a = 7.0
b = 0.1
input_variables = ['xi1', 'xi2', 'xi3', 'a', 'b']
formula = ['sin(xi1) + a * (sin(xi2)) ^ 2 + b * xi3^4 * sin(xi1)']
full = ot.SymbolicFunction(input_variables, formula)
ishigami_model = ot.ParametricFunction(full, [3, 4], [a, b])
distribution = ot.ComposedDistribution([ot.Uniform(-pi, pi)] * dimension)
lhs_validation = ot.MonteCarloExperiment(distribution, 100)
input_validation = lhs_validation.generate()
X = input_validation
Y = ishigami_model(input_validation)
coll = [ ]
for i in range ( dimension):
coll.append(ot.StandardDistributionPolynomialFactory(
distribution.getMarginal(i)))
enumerateFunction = ot.LinearEnumerateFunction( dimension )
productBasis = ot.OrthogonalProductPolynomialFactory( coll ,
enumerateFunction )
# c r e a t e the algor i thm
degree = 6
adaptiveStrategy = ot.FixedStrategy (productBasis , enumerateFunction .
getStrataCumulatedCardinal ( degree ) )
projection_strategy = ot.LeastSquaresStrategy ()
algo = ot.FunctionalChaosAlgorithm( X, Y, distribution , adaptiveStrategy
,projection_strategy )
algo.run()
_______________________________________________
OpenTURNS users mailing list
[email protected]
http://openturns.org/mailman/listinfo/users