Multilevel Polynomial Chaos Expansion¶
multilevel
¶
Multilevel polynomial chaos expansion.
This module provides a class for multilevel polynomial chaos expansion (PCE). Given a response surface \(Q: \Omega \rightarrow \mathbb{R}^k\), we aim to approximate it using a sequence of approximative response surfaces \(Q_n: \Omega \rightarrow \mathbb{R}^k\). For a fixed level \(L \in \mathbb{N}\), consider a sequence of increasing discretization parameters \(\{n_0, \ldots, n_L\} \in \mathbb{N}^{L+1}\). Consider the telescopic sum
The multilevel idea is now to approximate each term in the sum using an independent optimally weighted PCE. For this, similary, consider a sequence of increasing polynomial space parameters \(\{m_0, \ldots, m_L\} \in \mathbb{N}^{L+1}\), and define the multilevel PCE as
where \(V_m\) denotes the polynomial space associated to parameter \(m\).
Classes:
Name | Description |
---|---|
MultilevelPCE |
Multilevel PCE class. |
multichaos.multilevel.MultilevelPCE
¶
Multilevel polynomial chaos expansion.
This class implements a multilevel polynomial chaos expansion using optimal weighted least squares.
Attributes:
Name | Type | Description |
---|---|---|
dist |
ot.Distribution
|
Input distribution. |
response |
callable
|
Response function. |
index_set_type |
str
|
Index set type. |
rates |
dict
|
Rates of convergence. |
tol |
float
|
Error tolerance. |
C_n |
int
|
Constant for discretization tuning. |
C_m |
int
|
Constant for polynomial space tuning. |
data_in |
np.ndarray
|
Input data points. |
data_out |
np.ndarray
|
Output data points. |
__init__
¶
Initialize Multilevel PCE object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dist
|
ot.Distribution
|
Input distribution. |
required |
response
|
callable
|
Response function. |
required |
index_set_type
|
str
|
Index set type. |
required |
rates
|
dict
|
Rates of convergence. |
required |
tol
|
float
|
Error tolerance. |
required |
C_n
|
int
|
Constant for discretization tuning. |
1
|
C_m
|
int
|
Constant for polynomial space tuning. |
1
|
data_in
|
list[np.ndarray]
|
Input data points. |
None
|
data_out
|
list[np.ndarray]
|
Output data points. |
None
|
set_problem_rates
¶
Sets the rates of convergence for the problem.
Given a response \(Q\) and approximative responses \(Q_n\) for \(n \in \mathbb{N}\), e.g., those obtained using a PDE solver with \(n \in \mathbb{N}\) discretization points, we make the following assumptions:
- \(\|Q - Q_n\| \lesssim n^{-\beta}\)
- \(\text{Work}(Q_n) \lesssim n^{\gamma}\)
- \(\inf_{v \in V_m} \|Q - v\| \lesssim m^{-\alpha}\)
- \(\text{dim}(V_m) \lesssim m^{\sigma}\)
Note
If some of these rates are unknown for the problem at hand, the user can consider the apative PCE.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
beta
|
float
|
Rate for discretization error. |
required |
gamma
|
float
|
Rate for work per sample. |
required |
alpha
|
float
|
Rate for polynomial approximability. |
required |
sigma
|
float
|
Rate for polynomial dimensionality. |
required |
set_asymptotic_cost_rates
¶
Sets the asymptotic cost rates for the problem.
Given the problem rates \(\beta, \gamma, \alpha, \sigma > 0\), the costs for the ML-PCE to reach an error \(\epsilon > 0\) are given by
where \(\lambda = \max \left(\gamma / \beta,\, \sigma / \alpha\right)\) and
set_number_of_levels
¶
Sets the number of levels for the ML-PCE.
Given an error tolerance \(\epsilon > 0\), the number of levels \(L \in \mathbb{N}\) is chosen such that for the \(L^2\) error \(\|\hat{Q} - Q\|_{L^2} \leq \epsilon\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tol
|
float
|
Error tolerance. |
required |
set_tuning_params
¶
Sets the tuning parameters for the ML-PCE.
The discretization \(n_l\) and polynomial space parameters \(m_k\) are set as \(n_l := C_n \exp (l / (\beta + \gamma))\) and \(m_k := C_m \exp (k / (\alpha + \sigma))\) for \(k, l \in \{0, \ldots, L\}\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
C_n
|
int
|
Constant for discretization tuning. |
1
|
C_m
|
int
|
Constant for polynomial space tuning. |
1
|
Note
The constants \(C_n\) and \(C_m\) should be chosen sufficiently large.
Returns:
Type | Description |
---|---|
tuple[np.ndarray, np.ndarray]
|
Tuning parameters for sample size and polynomial space. |
set_sample_sizes
¶
Sets the optimal sample size for each level.
The optimal sample size is computed using the approximative dimension \(m_k^\sigma\) for each of the polynomial subspaces \(V_{m_k}\) for \(k \in \{0, \ldots, L\}\).
Returns:
Type | Description |
---|---|
np.ndarray
|
Sample sizes for each level. |
initialize_levels
¶
Initializes a PCE object on each level.
If the number of levels \(L \in \mathbb{N}\) is not provided, it is computed
using the error tolerance \(\epsilon > 0\).
This method initializes a PCE object for each level \(l \in \{0, \ldots, L\}\)
with the corresponding tuning parameters \((n_l, m_l)\)
and stores them in the level_estimators
list attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
eps
|
float
|
Error tolerance. |
required |
L
|
int
|
Number of levels. |
None
|
set_data
¶
Sets the data for each level PCE.
For level \(l=0\), the response \(Q_{n_0}\) and for the remaining \(l \in \{1, \ldots, L\}\), the response differences \(Q_{n_l} - Q_{n_{l-1}}\) are evaluated in the optimal number of samples \(N_l\).
compute_coefficients
¶
Computes the coefficients.
This method computes the PCE coefficients by running the
compute_coefficients
method of each level estimator. The coefficients are then aggregated
using the aggregate_coefficients
function.