1D Linear operator with two parameters¶
In the previous examples we focus on systems with only one parameter. To see if the framework can be applied to a more general case, we use a 1D linear operator on two parameters, and verify the prediction.
Here we set up the linear operator as follows:
A suitable solution can be:
In this example, we assume \(\phi_1 = 2\), \(\phi_2 = 5\), and estimate \(\phi_1\) and \(\phi_2\).
Simulate data¶
In [2]:
##Initiating f(x) and u(x) with 20 data points
x = np.random.rand(20)
phi1 = 2.0
phi2 = 5.0
y_u = np.sin(x)
y_f = phi1*np.sin(x) + phi2*np.cos(x)
Evaluate kernels¶
Corresponding kernels are defined as following:
\(k _ { u u } \left( x _ { i } , x _ { j } ; \theta \right) = \theta \exp \left( - \frac { 1 } { 2 l } \left( x _ { i } - x _ { j } \right) ^ { 2 } \right)\)
\(\left. \begin{array} { l } { k _ { f f } \left( x _ { i } , x _ { j } ; \theta , \phi _ { 1 } , \phi _ { 2 } \right) } \\ { = \mathcal { L } _ { x _ { i } } ^ { \phi } \mathcal { L } _ { x _ { j } } ^ { \phi } k _ { u u } \left( x _ { i } , x _ { j } ; \theta \right) } \\ { = \mathcal { L } _ { x _ { i } } ^ { \phi } \left( \phi _ { 1 } k _ { u u } + \phi _ { 2 } \frac { \partial } { \partial x _ { j } } k _ { u u } \right) } \\ { = \phi _ { 1 } ^ { 2 } k _ { u u } + \phi _ { 1 } \phi _ { 2 } \frac { \partial } { \partial x _ { j } } k _ { u u } + \phi _ { 1 } \phi _ { 2 } \frac { \partial } { \partial x _ { i } } k _ { u u } + \phi _ { 2 } ^ { 2 } \frac { \partial } { \partial x _ { i } } \frac { \partial } { \partial x _ { i } } k _ { u u } } \end{array} \right.\)
\(k_{fu}(x_i,x_j;\theta,\phi_1, \phi_2) \\ = \mathcal{L}_{x_i}^\phi k_{uu}(x_i, x_j; \theta) \\ = \phi_1 k_{uu} + \phi_2 \frac{\partial}{\partial x_i}k_{uu}\)
\(\left. \begin{array} { l } { k _ { u f } \left( x _ { i } , x _ { j } ; \theta , \phi _ { 1 } , \phi _ { 2 } \right) } \\ { = \mathcal { L } _ { x _ { j } } ^ { \phi } k _ { u u } \left( x _ { i } , x _ { j } ; \theta \right) } \end{array} \right.\)
Optimize hyperparameters¶
In [14]:
phi ## Estimated phi1 and phi2 using noiseless data points
Out[14]:
[1.9999955379492513, 5.000001322351089]
Parameter | Value |
---|---|
\(\phi_1\) | 1.9999 |
\(\phi_2\) | 5.0000 |
We see that the error rate is less than 0.01% for the hyperparameter estimation. This example shows, that one can use our framework for multiple parameter estimation.