Kernel
MaternKernel
gptempest.MaternKernel
Bases: Module
Matérn covariance kernel for Gaussian Process regression.
Computes the Matérn kernel between sets of time points. The smoothness parameter ν controls the differentiability of the GP sample paths: ν=0.5 gives the Ornstein–Uhlenbeck process, ν=1.5 once-differentiable paths, and ν=2.5 twice-differentiable paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scale
|
float
|
Time-scale parameter. Larger values mean slower-varying GPs. Typically set to the number of frames in the trajectory. |
required |
nu
|
float
|
Matérn smoothness parameter. Must be one of |
required |
dtype
|
dtype
|
PyTorch dtype, e.g. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
Example
Source code in src/gptempest/model.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
to(device)
kernel_mat(t1, t2)
Compute the full Matérn kernel matrix between two time arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t1
|
Time array of shape |
required | |
t2
|
Time array of shape |
required |
Returns:
| Type | Description |
|---|---|
|
Kernel matrix of shape |
Source code in src/gptempest/model.py
kernel_diag(t1, t2)
Compute element-wise Matérn kernel values between paired time points.
Equivalent to the diagonal of kernel_mat(t1, t2) but more
efficient as it avoids computing the full pairwise distance matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t1
|
Time array of shape |
required | |
t2
|
Time array of shape |
required |
Returns:
| Type | Description |
|---|---|
|
Kernel values of shape |