pysdic.ComposedParametrization._encode#
- ComposedParametrization._encode(p_i, *, dp=False, kwargs=None)[source]#
Encode the parameters through the sequence of parametrizations.
\[\vec{p_o} = P_n(P_{n-1}(...P_1(\vec{p_i})...))\]The jacobian with respect to the parameters is computed using the chain rule across the sequence of parametrizations:
\[\mathbf{J}_p = \frac{\partial P_n}{\partial \vec{q}_{n-1}} \cdot ... \cdot \frac{\partial P_2}{\partial \vec{q}_1} \cdot \frac{\partial P_1}{\partial \vec{p_i}}\]where \(\vec{q}_k = P_k(...P_1(\vec{p_i})...)\) are the intermediate parameters.
- Parameters:
p_i (numpy.ndarray) – The parameters to encode, with shape \((n_i,)\) where \(n_i\) is the input dimension of the first parametrization in the composition.
dp (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the parameters during encoding. (ie., \(\mathbf{J}_p = \frac{\partial P_n \circ ... \circ P_1}{\partial \vec{p_i}}\)).kwargs (Optional[List[Optional[Dict[str, Any]]]], optional (default:
None)) – A list of dictionaries containing additional keyword arguments to pass to each parametrization’s encode method. The list must have the same length as the number of parametrizations in the composition, in the order \([P_1, P_2, ..., P_n]\).Noneelements are replaced by empty dictionaries.
- Returns:
numpy.ndarray – The encoded parameters after applying the sequence of parametrizations, with shape \((n_o,)\) where \(n_o\) is the output dimension of the last parametrization in the composition.
Optional[numpy.ndarray] – The Jacobian matrix with respect to the input parameters if
dp=True, with shape \((n_o, n_i)\), or None ifdp=False.
- Return type: