Hard-constrained architectures
Learning objectives
- Write a hard constraint as an output transform, , with zero where the value is known
- Build the column's water into Section 0.9's network and show its error there is exactly zero
- Measure what the constraint does to the short wavelengths, with and without Fourier features
- Say what a hard constraint cures and what it does not
Exact by Construction
An architecture can make what is known exact. The water at the top of the column, 1500 m/s to 400 m, is the one part of it a survey knows before any fit, and writing it into the network's output, , holds the fit to it to the last bit whatever the network does, leaving the rock below. For Section 0.9's network that is also a remedy for spectral bias: in the same 3000 steps its miss of the band from 125 m to 250 m falls from 83 % to 51 %, and its fit from 106 m/s RMS to 61 m/s. With Section 2.2's Fourier features it adds exactness and little else, 5.9 m/s to 4.7 m/s: a hard constraint is a remedy for what is known, not for what is short.
The Transform
The network's output is not the fit. The fit is , with (1 here, since the book's is the water's 1500 m/s) and . At every depth of the water and for every weight, so the fit there is the water's velocity exactly; the loss is Section 0.9's, and its gradient reaches only through the depths below. Lagaris, Likas and Fotiadis (1997) built trial solutions of this kind, a part that satisfies the conditions with no adjustable parameters and a network term that cannot change them, and Sukumar and Srivastava (2021) made the second a distance to the boundary times the network: is the depth below the water's foot. The water's velocity and depth are read from the column: its velocity at the surface and the deepest node at it, 400 m, the book's stand-in for what an echo sounder and the water's known velocity give. They are the truth's own values: a hard constraint is only as right as what it builds in.
Exact, and a Little More
Learning the water, Section 0.9's network is up to 48 m/s off in it; built in, its error is exactly 0 at every depth to 400 m, and below the water the fit goes from 120 m/s RMS to 70 m/s. Its miss of the band from 250 m to 500 m falls from 77 % to 31 % and of the band from 125 m to 250 m from 83 % to 51 %: the water and the corner at its foot are short wavelengths the network no longer has to learn. With Fourier features at the water's largest error goes from 4.3 m/s to 0 and the fit from 5.9 m/s to 4.7 m/s RMS; the features had already learnt the layers.
What It Is Not
The constraint adds no parameter, 321 here as in Section 0.9, and cures nothing it does not know: the vanilla network with the water built in still misses 90 % of the wavelengths shorter than 125 m. Part 4 writes the same kind of transform for the wave on the column, zero at the free surface and at rest before the pulse moves.
What Comes Next
Section 2.5 draws the Fourier features at two scales at once: a long one for the trend and a short one for the layers.
References
- Lagaris, I. E., Likas, A. and Fotiadis, D. I. (1997). Artificial neural networks for solving ordinary and partial differential equations. arXiv:physics/9705023.
- Sukumar, N. and Srivastava, A. (2021). Exact imposition of boundary conditions with distance functions in physics-informed deep neural networks. arXiv:2104.08426.