jonathf / chaospy

Chaospy - Toolbox for performing uncertainty quantification.
https://chaospy.readthedocs.io/
MIT License
439 stars 87 forks source link

absolute/relative error #47

Closed cepez closed 7 years ago

cepez commented 7 years ago

Hi,

First of all, thanks for this amazing software, it is being very useful for my work!

My question regards the error (L2 norm) in the approximation of a quantity of interest by a polynomial expansion using the point collocation method. How to calculate it when the quantity of interest is a scalar? and what about a field? In neither of these cases an analytic expression is available for the qoi.

Is there any specific function in chaospy to do so (or in any known python library)?

Thanks for your help!

jonathf commented 7 years ago

I am a little confused what QoI is in your case, so I suspect that I might have misunderstood something. Please clarify if that is the case.

The point collocation method fits samples (more than one) to polynomials. Roughly speaking, fit_regression does the the following:

uhat = numpy.linalg.lstsq(P(*x), y)
poly = cp.sum(P*uhat, -1)

where P is the polynomial expansion, y is evaluations to be fitted and x are nodes/abscissas. In other words, the polynomial coefficient are sample wise fitted using numpy least square minimization which corresponds to minimization under the L2 norm. L2 norm can not be used on the polynomial nor QoI.

cepez commented 7 years ago

Hi jonathf,

I am sorry, my issue was not very well explained and for sure I mixed some concepts. I just was wondering how to be sure you got converged results or how to measure the error in the approximation of u by u_hat. When I said Qoi I meant any quantity of interest obtained from the solution of the model solver, that could be function of points in space (x,y,z) or not. For this question, equivalent to u then.

Thanks again!

jonathf commented 7 years ago

Ah, right. Yes I misunderstood then.

There is no single way of identify convergence with polynomial chaos expansions that I am aware of, and using L2 directly on QoI is not possible as far as I know.

My suggestion would be to set up a cross-validation scheme. There you can use e.g. the L2 norm to see if the approximation has converged or not.