Part 12 (10 points, coding task)
In this part, you are asked to do the following tasks to test the effectiveness of our PINN model.
-
Generate a dataset \left\{ \left( t , x \right) \in \left\{ 0, 0.01, \cdots, 1 \right\}^2 \right\}. Save the dataset as a tensor with name
tx_test
and shape(101,2)
. -
For each data point, compute u \left( t , x \right) whose formula is given in Part 1. Save the result as a tensor with name
u_test
and shape(101,2)
. -
For each data point, use our trained PINN model to compute the predicted value U \left( t, x \mid \mathbf{\theta} \right). Save the result as a tensor with name
U_test
and shape(101,2)
. -
Print the mean squared error between
u_test
andU_test
. -
Generate two 2-dim scatter plots for \left( t, x \right) by using the above data points.
-
In Figure 1, the value on each position is the ground-truth temperature u \left( t , x \right).
-
In Figure 2, the value on each position is the predicted temperature U \left( t, x \mid \mathbf{\theta} \right).
-
In each plot,
-
Set
c
as the values on those scattered positions -
Set
cmap='viridis'
-
Add
plt.colorbar(label='Value')
.
-
-