I have a function y = g(x1, ..., xd) where x1, ..., xd are the inputs and y is the output of the function g. I have a multidimensional multivariate sample X and the corresponding output sample Y from the function g. I have computed the polynomial chaos expansion of this function. How to estimate the Q2 leave-one-out cross-validation score using an analytical method?
For example, consider the following sample based on the Ishigami function. The next script computes the coefficients of the PCE using a degree 8 polynomial. How to compute the Q2 score without actually performing the leave-one-out validation?
import openturns as ot
import openturns.experimental as otexp
from openturns.usecases import ishigami_function
im = ishigami_function.IshigamiModel()
sampleSize = 500
inputTrain = im.inputDistribution.getSample(sampleSize)
outputTrain = im.model(inputTrain)
multivariateBasis = ot.OrthogonalProductPolynomialFactory([im.X1, im.X2, im.X3])
selectionAlgorithm = ot.PenalizedLeastSquaresAlgorithmFactory()
projectionStrategy = ot.LeastSquaresStrategy(inputTrain, outputTrain, selectionAlgorithm)
totalDegree = 8
enumerateFunction = multivariateBasis.getEnumerateFunction()
basisSize = enumerateFunction.getBasisSizeFromTotalDegree(totalDegree)
adaptiveStrategy = ot.FixedStrategy(multivariateBasis, basisSize)
chaosalgo = ot.FunctionalChaosAlgorithm(
inputTrain, outputTrain, im.inputDistribution, adaptiveStrategy, projectionStrategy
)
chaosalgo.run()
result = chaosalgo.getResult()
I have a function y = g(x1, ..., xd) where x1, ..., xd are the inputs and y is the output of the function g. I have a multidimensional multivariate sample X and the corresponding output sample Y from the function g. I have computed the polynomial chaos expansion of this function. How to estimate the Q2 leave-one-out cross-validation score using an analytical method?
For example, consider the following sample based on the Ishigami function. The next script computes the coefficients of the PCE using a degree 8 polynomial. How to compute the Q2 score without actually performing the leave-one-out validation?
import openturns as ot
import openturns.experimental as otexp
from openturns.usecases import ishigami_function
im = ishigami_function.IshigamiModel()
sampleSize = 500
inputTrain = im.inputDistribution.getSample(sampleSize)
outputTrain = im.model(inputTrain)
multivariateBasis = ot.OrthogonalProductPolynomialFactory([im.X1, im.X2, im.X3])
selectionAlgorithm = ot.PenalizedLeastSquaresAlgorithmFactory()
projectionStrategy = ot.LeastSquaresStrategy(inputTrain, outputTrain, selectionAlgorithm)
totalDegree = 8
enumerateFunction = multivariateBasis.getEnumerateFunction()
basisSize = enumerateFunction.getBasisSizeFromTotalDegree(totalDegree)
adaptiveStrategy = ot.FixedStrategy(multivariateBasis, basisSize)
chaosalgo = ot.FunctionalChaosAlgorithm(
inputTrain, outputTrain, im.inputDistribution, adaptiveStrategy, projectionStrategy
)
chaosalgo.run()
result = chaosalgo.getResult()
Share
Improve this question
edited Mar 25 at 16:31
Michael Baudin
asked Mar 25 at 15:28
Michael BaudinMichael Baudin
1,15111 silver badges28 bronze badges
1 Answer
Reset to default 0splitterLOO = ot.LeaveOneOutSplitter(sampleSize)
validation = otexp.FunctionalChaosValidation(result, splitterLOO)
r2Score = validationputeR2Score()