Skip to content

Base Polynomial Chaos Expansion

base

Base class for Polynomial Chaos Expansion (PCE) models.

This module provides the base class for Polynomial Chaos Expansion (PCE) models. The class provides the basic functionality for constructing and evaluating PCE models.

Classes:

Name Description
BasePCE

Base class for Polynomial Chaos Expansion (PCE) models.

multichaos.base.BasePCE

Base class for Polynomial Chaos Expansion (PCE) models.

This class provides the basic functionality for constructing and evaluating PCE models. The class is designed to be inherited by other PCE models.

Attributes:

Name Type Description
dist ot.Distribution

Input probability distribution.

index_set np.ndarray

Index set of the PCE.

n_basis int

Number of basis functions in the PCE.

risk float
coefficients np.ndarray

Coefficients of the PCE.

input_dim int

Input dimension.

output_dim int

Output dimension.

tf callable

Transformation function.

tf_inv callable

Inverse transformation function.

__init__

__init__(dist, index_set=None, risk=0)

Initialize Base PCE object.

Parameters:

Name Type Description Default
dist ot.Distribution

Input probability distribution.

required
index_set np.ndarray

Index set of the PCE.

None
risk float 0

set_transformation

set_transformation()

Set the transformation functions.

This method sets up the necessary components for transforming the input distribution to the underlying measure of the PCE.

__call__

__call__(data_in)

Evaluate the PCE at the given input data.

Parameters:

Name Type Description Default
data_in np.ndarray

Input data points.

required

compute_mean

compute_mean()

Compute the mean of the PCE.

This returns the mean of the PCE \(P = \sum_{\lambda \in \Lambda} c_\lambda P_\lambda\), which, due to orthonormality, is given by \(\mathbb{E}[P] = c_\mathbf{0}\).

Returns:

Type Description
float

Mean of the PCE.

compute_variance

compute_variance()

Compute the variance of the PCE.

This returns the variance of the PCE \(P = \sum_{\lambda \in \Lambda} c_\lambda P_\lambda\), which, due to orthonormality, is given by \(\mathbb{V}[P] = \sum_{\lambda \in \Lambda \setminus \{\mathbf{0}\}} c_\lambda^2\).

Returns:

Type Description
float

Variance of the PCE.

l2_error

l2_error(data_in, data_out)

Compute the \(L^2\) error of the PCE.

This method computes the root mean squared error as an estimate to the \(L^2\) error of the PCE with respect to the given data, i.e.

\[ \begin{equation} \|Q - \hat{Q}\|_{L^2} \approx \left( \frac{1}{N} \sum_{i=1}^N (Q_i - \hat{Q}(\omega_i))^2 \right)^{1/2}, \end{equation} \]

where \(\{(\omega_i, Q_i)\}_{i=1}^N\) denotes the data and \(\hat{Q}\) the PCE model.

Parameters:

Name Type Description Default
data_in np.ndarray

Input data points of shape (n_samples, input_dim).

required
data_out np.ndarray

Output data points of shape (n_samples, output_dim).

required

Returns:

Type Description
float

Root mean squared error.