The Matern 5/2 kernel. Functions drawn from a GP with this kernel are twice differentiable. The kernel equation is k(r) = σ² (1 + √5r + 5/3r²) exp{-√5 r} where: r is the Euclidean distance between the input points, scaled by the lengthscales parameter ℓ, σ² is the varianc
| 293 | |
| 294 | |
| 295 | class Matern52(IsotropicStationary): |
| 296 | """ |
| 297 | The Matern 5/2 kernel. Functions drawn from a GP with this kernel are twice |
| 298 | differentiable. The kernel equation is |
| 299 | |
| 300 | k(r) = σ² (1 + √5r + 5/3r²) exp{-√5 r} |
| 301 | |
| 302 | where: |
| 303 | r is the Euclidean distance between the input points, scaled by the lengthscales parameter ℓ, |
| 304 | σ² is the variance parameter. |
| 305 | """ |
| 306 | |
| 307 | @check_shapes( |
| 308 | "r: [batch..., N]", |
| 309 | "return: [batch..., N]", |
| 310 | ) |
| 311 | def K_r(self, r: TensorType) -> tf.Tensor: |
| 312 | sqrt5 = np.sqrt(5.0) |
| 313 | return self.variance * (1.0 + sqrt5 * r + 5.0 / 3.0 * tf.square(r)) * tf.exp(-sqrt5 * r) |
| 314 | |
| 315 | |
| 316 | class Cosine(AnisotropicStationary): |
no outgoing calls
searching dependent graphs…