Collocation Interface

The two-stage estimator accepts either one of the built-in kernel symbols or a custom DiffEqParamEstim.CollocationKernel implementation. A custom kernel is a field-free subtype that extends DiffEqParamEstim.calckernel for scalar numeric offsets. The method must return one scalar weight and should preserve the numeric type of its offset so that automatic differentiation can propagate through the objective.

This is a developer interface. It is documented and versioned for packages that extend the two-stage estimator, but it is not exported as part of the ordinary user API.

DiffEqParamEstim.CollocationKernel — Type
CollocationKernel

Developer interface for the kernel used by two_stage_objective to smooth the observed state trajectory before estimating its derivative.

CollocationKernel is an abstract, field-free marker type. To add a custom

Interface

  • Define a field-free subtype of CollocationKernel.
  • Extend DiffEqParamEstim.calckernel(::MyKernel, t) for scalar numeric t.
  • Return one scalar weight for each offset; two_stage_objective broadcasts the method over all normalized time offsets.
  • Keep the implementation generic over the numeric type of t so that automatic-differentiation element types are preserved.

The built-in implementations are EpanechnikovKernel, UniformKernel, TriangularKernel, QuarticKernel, TriweightKernel, TricubeKernel, GaussianKernel, CosineKernel, LogisticKernel, SigmoidKernel, and SilvermanKernel.

Examples

struct MyKernel <: DiffEqParamEstim.CollocationKernel end

DiffEqParamEstim.calckernel(::MyKernel, t) = exp(-abs(t))

objective = two_stage_objective(prob, tpoints, data; kernel = MyKernel())
source
DiffEqParamEstim.calckernel — Method
calckernel(kernel::CollocationKernel, t) -> Number

Return the scalar smoothing weight for kernel at the normalized offset t.

This is a developer extension point rather than a user-facing operation. A custom CollocationKernel must provide a method for its own type. The method is called with scalar offsets and must preserve the numeric type of t when practical; this allows the two-stage objective to work with automatic differentiation values.

Arguments

  • kernel::CollocationKernel: the kernel marker selecting the weighting rule.
  • t: a scalar normalized time offset.

Returns

  • Number: the kernel weight at t.

Examples

struct ExponentialKernel <: DiffEqParamEstim.CollocationKernel end
DiffEqParamEstim.calckernel(::ExponentialKernel, t) = exp(-abs(t))

weight = DiffEqParamEstim.calckernel(ExponentialKernel(), 0.25)
source