Liking cljdoc? Tell your friends :D

fastmath.kernel.rbf

Radial basis function (RBF) families.

Every family is a constructor which takes a map of parameters and returns a function r -> double of the distance r (a negative r is treated as abs(r) unless stated otherwise). Constructors are called with a map, with nil or without arguments; parameters which are not optional have no default and a missing (or non-numeric, or non-finite) one throws ex-info with :type :invalid-input, :family (the family keyword) and :property (the missing key).

Every family accepts :scale (default 1.0), which divides the distance: the kernel is evaluated at rho = r / scale. For the compactly supported families (truncated-power, wendland, gneiting, wu) scale is the support radius, for the others it is a length scale.

Families by kind:

The registry fastmath.kernel/rbf creates these functions by keyword and adds presets.

Literature: [1] Meshfree Approximation Methods with MATLAB (Fasshauer, 2007) and MATH 590 lecture notes, chapter 11; [2] Wendland, Scattered Data Approximation (2005); [3] Luh, The Shape Parameter in the Shifted Surface Spline (arXiv:1011.0124); [4] Gneiting, Compactly supported correlation functions (2002); [5] Wu, Compactly supported positive definite radial functions (1995).

Radial basis function (RBF) families.

Every family is a constructor which takes a map of parameters and returns a function `r -> double` of the distance `r` (a negative `r` is treated as `abs(r)` unless stated otherwise). Constructors are called with a map, with `nil` or without arguments; parameters which are not optional have no default and a missing (or non-numeric, or non-finite) one throws `ex-info` with `:type :invalid-input`, `:family` (the family keyword) and `:property` (the missing key).

Every family accepts `:scale` (default `1.0`), which divides the distance: the kernel is evaluated at `rho = r / scale`. For the compactly supported families (`truncated-power`, `wendland`, `gneiting`, `wu`) `scale` is the support radius, for the others it is a length scale.

Families by kind:

- positive definite in every dimension: [[gaussian]], [[matern]] (odd order), [[generalized-multiquadratic]] with negative `beta` (inverse multiquadric),
- compactly supported: [[truncated-power]], [[wendland]], [[gneiting]] (oscillating), [[wu]],
- positive definite up to a dimension: [[gaussians-laguerre]], [[poisson]], [[whittaker]],
- conditionally positive definite (use them with polynomial terms): [[linear]], [[generalized-multiquadratic]], [[radial-powers]], [[thin-plate-splines]], [[shifted-surface-splines]].

The registry `fastmath.kernel/rbf` creates these functions by keyword and adds presets.

Literature: [1] Meshfree Approximation Methods with MATLAB (Fasshauer, 2007) and MATH 590 lecture notes, chapter 11; [2] Wendland, Scattered Data Approximation (2005); [3] Luh, The Shape Parameter in the Shifted Surface Spline (arXiv:1011.0124); [4] Gneiting, Compactly supported correlation functions (2002); [5] Wu, Compactly supported positive definite radial functions (1995).
raw docstring

gaussianclj

(gaussian)
(gaussian params)

Gaussian kernel: exp(-(r / scale)^2).

Parameters:

  • params (map, optional):
    • :scale (double, default 1.0): length scale. The value at r = scale is exp(-1); the standard deviation of the matching Gaussian density is scale / sqrt(2).

Returns a function r -> double. The value at r = 0 is 1.0; the function is symmetric, positive, decreasing in abs(r) and not compactly supported (it underflows to 0.0 for abs(r / scale) above about 27).

Strictly positive definite in every dimension.

See also matern, wendland, generalized-multiquadratic.

Gaussian kernel: `exp(-(r / scale)^2)`.

Parameters:

- `params` (map, optional):
  - `:scale` (double, default `1.0`): length scale. The value at `r = scale` is `exp(-1)`; the standard deviation of the matching Gaussian density is `scale / sqrt(2)`.

Returns a function `r -> double`. The value at `r = 0` is `1.0`; the function is symmetric, positive, decreasing in `abs(r)` and not compactly supported (it underflows to `0.0` for `abs(r / scale)` above about 27).

Strictly positive definite in every dimension.

See also [[matern]], [[wendland]], [[generalized-multiquadratic]].
raw docstring

gaussians-laguerreclj

(gaussians-laguerre)
(gaussians-laguerre params)

Gaussians-Laguerre kernel: exp(-rho^2) * L_n^(d/2)(rho^2) with rho = r / scale, the generalized Laguerre polynomial of degree n and order d/2.

Parameters:

  • params (map):
    • :dimension (double, required, positive): the dimension d, it sets the order d/2 of the polynomial.
    • :degree (long, required, non-negative): the degree n. A whole double such as 2.0 is accepted.
    • :scale (double, default 1.0): length scale.

Returns a function r -> double. The kernel is not normalised: the value at r = 0 is L_n^(d/2)(0), the binomial coefficient C(n + d/2, n) (for example 1.5 for :dimension 1.0, :degree 1; 1.0 for degree 0). It is symmetric and decays like a Gaussian times a polynomial, so it is not compactly supported and oscillates for a positive degree. A missing :dimension or :degree throws ex-info.

Positive definite in R^s for every s <= dimension (and not beyond it).

See also gaussian, poisson.

Gaussians-Laguerre kernel: `exp(-rho^2) * L_n^(d/2)(rho^2)` with `rho = r / scale`, the generalized Laguerre polynomial of degree `n` and order `d/2`.

Parameters:

- `params` (map):
  - `:dimension` (double, required, positive): the dimension `d`, it sets the order `d/2` of the polynomial.
  - `:degree` (long, required, non-negative): the degree `n`. A whole double such as `2.0` is accepted.
  - `:scale` (double, default `1.0`): length scale.

Returns a function `r -> double`. The kernel is not normalised: the value at `r = 0` is `L_n^(d/2)(0)`, the binomial coefficient `C(n + d/2, n)` (for example `1.5` for `:dimension 1.0`, `:degree 1`; `1.0` for degree 0). It is symmetric and decays like a Gaussian times a polynomial, so it is not compactly supported and oscillates for a positive degree. A missing `:dimension` or `:degree` throws `ex-info`.

Positive definite in R^s for every `s <= dimension` (and not beyond it).

See also [[gaussian]], [[poisson]].
raw docstring

generalized-multiquadraticclj

(generalized-multiquadratic)
(generalized-multiquadratic params)

Generalized multiquadratic kernel: sign * (1 + rho^2)^beta with rho = r / scale.

Parameters:

  • params (map):
    • :beta (double, required): the exponent. 0.5 is the multiquadric, -0.5 the inverse multiquadric, -1 the inverse quadric. Closed forms are used for 1/3, 0.5, 1, 2, 3 and the negatives of them.
    • :negate? (:auto, true or false, default :auto): the sign. true multiplies by -1, false by +1. :auto (also for nil) chooses the sign of the conditionally positive definite form: (-1)^ceil(beta) for beta > 0 (negative for beta in (0, 1], positive for (1, 2], negative for (2, 3], ...) and +1 for beta <= 0.
    • :scale (double, default 1.0): length scale (shape parameter is 1 / scale).

Returns a function r -> double. The value at r = 0 is the sign. The function is symmetric, smooth and grows like abs(r)^(2 beta) for a positive beta (it overflows to infinity for a huge r), and decays for a negative beta. A missing :beta throws ex-info.

Positive definiteness: strictly positive definite in every dimension for beta < 0 (sign +1). For beta > 0 conditionally positive definite of order ceil(beta) (needs polynomial terms of degree ceil(beta) - 1) with the :auto sign, checked numerically for beta up to 3.5; beyond that the sign rule follows the literature but is not verified. A non-negative integer beta gives a polynomial in r which is not a usable basis function on its own.

See also radial-powers, thin-plate-splines, shifted-surface-splines.

Generalized multiquadratic kernel: `sign * (1 + rho^2)^beta` with `rho = r / scale`.

Parameters:

- `params` (map):
  - `:beta` (double, required): the exponent. `0.5` is the multiquadric, `-0.5` the inverse multiquadric, `-1` the inverse quadric. Closed forms are used for `1/3`, `0.5`, `1`, `2`, `3` and the negatives of them.
  - `:negate?` (`:auto`, `true` or `false`, default `:auto`): the sign. `true` multiplies by `-1`, `false` by `+1`. `:auto` (also for `nil`) chooses the sign of the conditionally positive definite form: `(-1)^ceil(beta)` for `beta > 0` (negative for `beta` in `(0, 1]`, positive for `(1, 2]`, negative for `(2, 3]`, ...) and `+1` for `beta <= 0`.
  - `:scale` (double, default `1.0`): length scale (shape parameter is `1 / scale`).

Returns a function `r -> double`. The value at `r = 0` is the sign. The function is symmetric, smooth and grows like `abs(r)^(2 beta)` for a positive `beta` (it overflows to infinity for a huge `r`), and decays for a negative `beta`. A missing `:beta` throws `ex-info`.

Positive definiteness: strictly positive definite in every dimension for `beta < 0` (sign `+1`). For `beta > 0` conditionally positive definite of order `ceil(beta)` (needs polynomial terms of degree `ceil(beta) - 1`) with the `:auto` sign, checked numerically for `beta` up to 3.5; beyond that the sign rule follows the literature but is not verified. A non-negative integer `beta` gives a polynomial in `r` which is not a usable basis function on its own.

See also [[radial-powers]], [[thin-plate-splines]], [[shifted-surface-splines]].
raw docstring

gneitingclj

(gneiting)
(gneiting params)

Gneiting kernel family: the oscillating compactly supported function (1 - rho)_+^l * (1 + l rho - (l + 1)(l + s + 2) / s * rho^2) with rho = r / scale (the turning bands operator applied to a Wendland function).

Parameters:

  • params (map):
    • :s (double, required, positive): the space dimension.
    • :l (double, required): the exponent.
    • :scale (double, default 1.0): the support radius.

Returns a function r -> double. The value at r = 0 is 1.0; it is symmetric, takes negative values (it oscillates) and is 0.0 at abs(r) = scale and beyond. A missing :s or :l or a non-positive :s throws ex-info (the formula divides by s).

Positive definite in R^s if and only if l >= (s + 5) / 2.

See also wendland, wu, truncated-power.

Gneiting kernel family: the oscillating compactly supported function `(1 - rho)_+^l * (1 + l rho - (l + 1)(l + s + 2) / s * rho^2)` with `rho = r / scale` (the turning bands operator applied to a Wendland function).

Parameters:

- `params` (map):
  - `:s` (double, required, positive): the space dimension.
  - `:l` (double, required): the exponent.
  - `:scale` (double, default `1.0`): the support radius.

Returns a function `r -> double`. The value at `r = 0` is `1.0`; it is symmetric, takes negative values (it oscillates) and is `0.0` at `abs(r) = scale` and beyond. A missing `:s` or `:l` or a non-positive `:s` throws `ex-info` (the formula divides by `s`).

Positive definite in R^s if and only if `l >= (s + 5) / 2`.

See also [[wendland]], [[wu]], [[truncated-power]].
raw docstring

linearclj

(linear)
(linear params)

Linear kernel, the distance itself: abs(r / scale).

Parameters:

  • params (map, optional):
    • :scale (double, default 1.0): length scale, the distance is divided by it.

Returns a function r -> double. The value at r = 0 is 0.0, the function is symmetric in r and grows without bound.

This is not a positive definite function: abs(r) is conditionally negative definite of order 1, so interpolation with it needs a constant polynomial term (and the sign is positive here, while radial-powers with beta = 1 gives -abs(r), the conditionally positive definite form).

See also radial-powers, thin-plate-splines, gaussian.

Linear kernel, the distance itself: `abs(r / scale)`.

Parameters:

- `params` (map, optional):
  - `:scale` (double, default `1.0`): length scale, the distance is divided by it.

Returns a function `r -> double`. The value at `r = 0` is `0.0`, the function is symmetric in `r` and grows without bound.

This is not a positive definite function: `abs(r)` is conditionally negative definite of order 1, so interpolation with it needs a constant polynomial term (and the sign is positive here, while [[radial-powers]] with `beta = 1` gives `-abs(r)`, the conditionally positive definite form).

See also [[radial-powers]], [[thin-plate-splines]], [[gaussian]].
raw docstring

maternclj

(matern)
(matern params)

Matern kernel for an odd order: 2^(1 - v) / Gamma(v) * rho^v * K_v(rho) with v = order / 2, rho = r / scale and the modified Bessel function of the second kind K_v.

Parameters:

  • params (map):
    • :order (long, required, odd and positive): twice the smoothness v. 1 gives exp(-rho), 3 gives (1 + rho) exp(-rho) and 5 gives (1 + rho + rho^2/3) exp(-rho). A whole double such as 3.0 is accepted.
    • :scale (double, default 1.0): length scale, applied without the sqrt(order) factor of other conventions: the length scale ell of the usual form (for example in scikit-learn) corresponds to scale = ell / sqrt(order).

Returns a function r -> double. The value at r = 0 is 1.0; it is symmetric, positive, decreasing and not compactly supported (it is 0.0 where it underflows). A missing :order throws ex-info; an even, zero, negative or non-integer :order throws ex-info with :property :order.

Strictly positive definite in every dimension.

See also gaussian, wendland.

Matern kernel for an odd `order`: `2^(1 - v) / Gamma(v) * rho^v * K_v(rho)` with `v = order / 2`, `rho = r / scale` and the modified Bessel function of the second kind `K_v`.

Parameters:

- `params` (map):
  - `:order` (long, required, odd and positive): twice the smoothness `v`. `1` gives `exp(-rho)`, `3` gives `(1 + rho) exp(-rho)` and `5` gives `(1 + rho + rho^2/3) exp(-rho)`. A whole double such as `3.0` is accepted.
  - `:scale` (double, default `1.0`): length scale, applied without the `sqrt(order)` factor of other conventions: the length scale `ell` of the usual form (for example in scikit-learn) corresponds to `scale = ell / sqrt(order)`.

Returns a function `r -> double`. The value at `r = 0` is `1.0`; it is symmetric, positive, decreasing and not compactly supported (it is `0.0` where it underflows). A missing `:order` throws `ex-info`; an even, zero, negative or non-integer `:order` throws `ex-info` with `:property :order`.

Strictly positive definite in every dimension.

See also [[gaussian]], [[wendland]].
raw docstring

poissonclj

(poisson)
(poisson params)

Poisson (Bessel) kernel: 2^p * Gamma(p + 1) * J_p(rho) / rho^p with p = d/2 - 1, rho = r / scale and the Bessel function of the first kind J_p.

Parameters:

  • params (map):
    • :d (double, required, at least 1): the dimension, it sets the Bessel order d/2 - 1. Closed forms are used for 1 (cosine), 2 (J_0), 3 (sin(rho)/rho) and 4 (2 J_1(rho)/rho).
    • :scale (double, default 1.0): length scale.

Returns a function r -> double. The function is normalised: the value at r = 0 is 1.0 for every d (the limit of J_p(rho)/rho^p, divided by its value 1/(2^p Gamma(p + 1))). It is symmetric, oscillating, and decays only like rho^(-(d - 1)/2), so it is not compactly supported. A missing :d throws ex-info.

Positive definite in R^s for every s <= d.

See also gaussians-laguerre, matern.

Poisson (Bessel) kernel: `2^p * Gamma(p + 1) * J_p(rho) / rho^p` with `p = d/2 - 1`, `rho = r / scale` and the Bessel function of the first kind `J_p`.

Parameters:

- `params` (map):
  - `:d` (double, required, at least `1`): the dimension, it sets the Bessel order `d/2 - 1`. Closed forms are used for `1` (cosine), `2` (`J_0`), `3` (`sin(rho)/rho`) and `4` (`2 J_1(rho)/rho`).
  - `:scale` (double, default `1.0`): length scale.

Returns a function `r -> double`. The function is normalised: the value at `r = 0` is `1.0` for every `d` (the limit of `J_p(rho)/rho^p`, divided by its value `1/(2^p Gamma(p + 1))`). It is symmetric, oscillating, and decays only like `rho^(-(d - 1)/2)`, so it is not compactly supported. A missing `:d` throws `ex-info`.

Positive definite in R^s for every `s <= d`.

See also [[gaussians-laguerre]], [[matern]].
raw docstring

radial-powersclj

(radial-powers)
(radial-powers params)

Radial powers kernel: sign * rho^beta with rho = abs(r / scale).

Parameters:

  • params (map):
    • :beta (double, required): the exponent. Closed forms are used for 1 and 3.
    • :negate? (:auto, true or false, default :auto): the sign. true multiplies by -1, false by +1. :auto (also for nil) uses (-1)^ceil(beta / 2): negative for beta in (0, 2], positive for (2, 4], negative for (4, 6], ...
    • :scale (double, default 1.0): length scale (it only scales the kernel by scale^(-beta)).

Returns a function r -> double. The value at r = 0 is 0.0 for a positive beta (1.0 for beta = 0, infinity for a negative beta). The function is symmetric. A missing :beta throws ex-info.

Conditionally positive definite of order ceil(beta / 2) for a positive beta which is not an even integer (needs polynomial terms of degree ceil(beta / 2) - 1); an even integer beta is a polynomial in the coordinates and is not usable. For a negative beta the :auto sign is just the same formula (+1 for beta in (-2, 0), -1 for (-4, -2]) and is not meant for it: the positive definite inverse powers (beta above -d in R^d, the Riesz kernels) need :negate? false.

See also linear, thin-plate-splines, generalized-multiquadratic.

Radial powers kernel: `sign * rho^beta` with `rho = abs(r / scale)`.

Parameters:

- `params` (map):
  - `:beta` (double, required): the exponent. Closed forms are used for `1` and `3`.
  - `:negate?` (`:auto`, `true` or `false`, default `:auto`): the sign. `true` multiplies by `-1`, `false` by `+1`. `:auto` (also for `nil`) uses `(-1)^ceil(beta / 2)`: negative for `beta` in `(0, 2]`, positive for `(2, 4]`, negative for `(4, 6]`, ...
  - `:scale` (double, default `1.0`): length scale (it only scales the kernel by `scale^(-beta)`).

Returns a function `r -> double`. The value at `r = 0` is `0.0` for a positive `beta` (`1.0` for `beta = 0`, infinity for a negative `beta`). The function is symmetric. A missing `:beta` throws `ex-info`.

Conditionally positive definite of order `ceil(beta / 2)` for a positive `beta` which is not an even integer (needs polynomial terms of degree `ceil(beta / 2) - 1`); an even integer `beta` is a polynomial in the coordinates and is not usable. For a negative `beta` the `:auto` sign is just the same formula (`+1` for `beta` in `(-2, 0)`, `-1` for `(-4, -2]`) and is not meant for it: the positive definite inverse powers (`beta` above `-d` in R^d, the Riesz kernels) need `:negate? false`.

See also [[linear]], [[thin-plate-splines]], [[generalized-multiquadratic]].
raw docstring

shifted-surface-splinesclj

(shifted-surface-splines)
(shifted-surface-splines params)

Shifted surface splines kernel family (Dyn, Levin and Rippa; in the form of Luh, equations (1) and (2) with beta in place of lambda).

With t = beta - s/2 and rho = r / scale the kernel is, for an odd s, (-1)^ceil(t) * (1 + rho^2)^t and, for an even s, (-1)^(1 + t) * (1 + rho^2)^t * log(sqrt(1 + rho^2)).

Parameters:

  • params (map):
    • :s (long, required, positive): the space dimension. A whole double such as 3.0 is accepted.
    • :beta (double, required): the exponent, must be greater than s / 2 (t > 0). For an even s it must be an integer (so that t is a positive integer), otherwise the sign is not defined.
    • :scale (double, default 1.0): length scale; it is the shape parameter c of Luh (his function is (r^2 + c^2)^t, the same as here up to the constant factor scale^(2 t)).

Returns a function r -> double. The value at r = 0 is the sign for an odd s and 0.0 for an even s. The function is symmetric and smooth (including at 0, the logarithm is of 1 + rho^2), and grows without bound (it overflows to infinity for a huge r). For example s = 3, beta = 2.5, r = 1 gives -2.0 (t = 1, sign -1). A missing :s or :beta, a non-integer :s, :s below 1, :beta not above s / 2 or a non-integer :beta for an even s throws ex-info.

Conditionally positive definite of order ceil(t) for an odd s (the generalized multiquadric with exponent t, see generalized-multiquadratic) and of order t + 1 for an even s; use polynomial terms of that order minus one degree.

See also generalized-multiquadratic, thin-plate-splines.

Shifted surface splines kernel family (Dyn, Levin and Rippa; in the form of Luh, equations (1) and (2) with `beta` in place of lambda).

With `t = beta - s/2` and `rho = r / scale` the kernel is, for an odd `s`, `(-1)^ceil(t) * (1 + rho^2)^t` and, for an even `s`, `(-1)^(1 + t) * (1 + rho^2)^t * log(sqrt(1 + rho^2))`.

Parameters:

- `params` (map):
  - `:s` (long, required, positive): the space dimension. A whole double such as `3.0` is accepted.
  - `:beta` (double, required): the exponent, must be greater than `s / 2` (`t > 0`). For an even `s` it must be an integer (so that `t` is a positive integer), otherwise the sign is not defined.
  - `:scale` (double, default `1.0`): length scale; it is the shape parameter `c` of Luh (his function is `(r^2 + c^2)^t`, the same as here up to the constant factor `scale^(2 t)`).

Returns a function `r -> double`. The value at `r = 0` is the sign for an odd `s` and `0.0` for an even `s`. The function is symmetric and smooth (including at 0, the logarithm is of `1 + rho^2`), and grows without bound (it overflows to infinity for a huge `r`). For example `s = 3`, `beta = 2.5`, `r = 1` gives `-2.0` (`t = 1`, sign `-1`). A missing `:s` or `:beta`, a non-integer `:s`, `:s` below 1, `:beta` not above `s / 2` or a non-integer `:beta` for an even `s` throws `ex-info`.

Conditionally positive definite of order `ceil(t)` for an odd `s` (the generalized multiquadric with exponent `t`, see [[generalized-multiquadratic]]) and of order `t + 1` for an even `s`; use polynomial terms of that order minus one degree.

See also [[generalized-multiquadratic]], [[thin-plate-splines]].
raw docstring

thin-plate-splinesclj

(thin-plate-splines)
(thin-plate-splines params)

Thin plate splines kernel: sign * rho^(2 beta) * log(rho) with rho = abs(r / scale).

Parameters:

  • params (map):
    • :beta (double, required, positive): the exponent. 1 is the classical thin plate spline rho^2 log(rho).
    • :negate? (:auto, true or false, default :auto): the sign. true multiplies by -1, false by +1. :auto (also for nil) uses (-1)^(ceil(beta) + 1): positive for beta = 1, negative for 2, positive for 3, negative for 4.
    • :scale (double, default 1.0): length scale. For an integer beta a change of the scale adds only the term rho^(2 beta) * log(scale), a polynomial which interpolation with polynomial terms of the needed degree does not see.

Returns a function r -> double. The value at r = 0 is 0.0 (the limit). The function is symmetric and negative for rho < 1 when the sign is positive. A missing :beta throws ex-info; a non-positive :beta throws ex-info with :property :beta.

Conditionally positive definite of order beta + 1 for an integer beta (needs polynomial terms of degree beta); the sign was checked numerically for beta 1, 2 and 3 (and 4 as an observation). For a non-integer beta the rule is uncertain: random point sets gave signs which depend on the dimension, so the function is not a valid conditionally positive definite function in all dimensions and the :auto sign has no guarantee.

See also radial-powers, generalized-multiquadratic.

Thin plate splines kernel: `sign * rho^(2 beta) * log(rho)` with `rho = abs(r / scale)`.

Parameters:

- `params` (map):
  - `:beta` (double, required, positive): the exponent. `1` is the classical thin plate spline `rho^2 log(rho)`.
  - `:negate?` (`:auto`, `true` or `false`, default `:auto`): the sign. `true` multiplies by `-1`, `false` by `+1`. `:auto` (also for `nil`) uses `(-1)^(ceil(beta) + 1)`: positive for `beta = 1`, negative for `2`, positive for `3`, negative for `4`.
  - `:scale` (double, default `1.0`): length scale. For an integer `beta` a change of the scale adds only the term `rho^(2 beta) * log(scale)`, a polynomial which interpolation with polynomial terms of the needed degree does not see.

Returns a function `r -> double`. The value at `r = 0` is `0.0` (the limit). The function is symmetric and negative for `rho < 1` when the sign is positive. A missing `:beta` throws `ex-info`; a non-positive `:beta` throws `ex-info` with `:property :beta`.

Conditionally positive definite of order `beta + 1` for an integer `beta` (needs polynomial terms of degree `beta`); the sign was checked numerically for `beta` 1, 2 and 3 (and 4 as an observation). For a non-integer `beta` the rule is uncertain: random point sets gave signs which depend on the dimension, so the function is not a valid conditionally positive definite function in all dimensions and the `:auto` sign has no guarantee.

See also [[radial-powers]], [[generalized-multiquadratic]].
raw docstring

truncated-powerclj

(truncated-power)
(truncated-power params)

Truncated power kernel: (1 - r / scale)^k for r below scale and 0 from there on.

Parameters:

  • params (map):
    • :k (double, required): the exponent. Closed forms are used for 1/3, 0.5, 1, 2 and 3.
    • :scale (double, default 1.0): the support radius.

Returns a function r -> double. The value at r = 0 is 1.0. The kernel is symmetric, decreasing, vanishes at abs(r) = scale (for k > 0; for k = 0 the value at abs(r) = scale is 1.0 and the jump is just beyond) and is 0.0 beyond it. A missing :k throws ex-info.

Positive definite in R^d only for d <= 2k - 1 (Askey: the exponent must be at least (d + 1) / 2): k = 1 in R^1, k = 2 in R^1 to R^3, k = 3 in R^1 to R^5. The exponents 1/3 and 0.5 are not positive definite in any dimension.

See also wendland, gneiting, wu.

Truncated power kernel: `(1 - r / scale)^k` for `r` below `scale` and `0` from there on.

Parameters:

- `params` (map):
  - `:k` (double, required): the exponent. Closed forms are used for `1/3`, `0.5`, `1`, `2` and `3`.
  - `:scale` (double, default `1.0`): the support radius.

Returns a function `r -> double`. The value at `r = 0` is `1.0`. The kernel is symmetric, decreasing, vanishes at `abs(r) = scale` (for `k > 0`; for `k = 0` the value at `abs(r) = scale` is `1.0` and the jump is just beyond) and is `0.0` beyond it. A missing `:k` throws `ex-info`.

Positive definite in R^d only for `d <= 2k - 1` (Askey: the exponent must be at least `(d + 1) / 2`): `k = 1` in R^1, `k = 2` in R^1 to R^3, `k = 3` in R^1 to R^5. The exponents `1/3` and `0.5` are not positive definite in any dimension.

See also [[wendland]], [[gneiting]], [[wu]].
raw docstring

wendlandclj

(wendland)
(wendland params)

Wendland kernel family: I^k (1 - rho)_+^l normalised to 1 at 0, with l = floor(s / 2) + k + 1, rho = r / scale and I f(rho) = integral from rho to 1 of t f(t) dt (Wendland and Fasshauer: the function of smoothness 2k which is positive definite in R^s).

Parameters:

  • params (map):
    • :s (double, required, at least 1): the space dimension. Only floor(s / 2) matters (s = 3 and s = 2 give the same function).
    • :k (long, required, from 0 to 4): the smoothness, the function is 2k times continuously differentiable. A whole double such as 2.0 is accepted.
    • :scale (double, default 1.0): the support radius.

Returns a function r -> double. On its support the function is a polynomial of degree floor(s / 2) + 3k + 1; for example k = 1, s = 3 is (1 - rho)^4 (4 rho + 1) (value 0.1875 at rho = 0.5). The value at r = 0 is 1.0; it is symmetric, decreasing, equal to 0.0 at abs(r) = scale and beyond. A missing :s or :k, :s below 1, a negative or non-integer :k or :k above 4 throws ex-info.

Strictly positive definite in R^d for every d <= s.

See also wu, gneiting, truncated-power, matern.

Wendland kernel family: `I^k (1 - rho)_+^l` normalised to `1` at `0`, with `l = floor(s / 2) + k + 1`, `rho = r / scale` and `I f(rho) = integral from rho to 1 of t f(t) dt` (Wendland and Fasshauer: the function of smoothness `2k` which is positive definite in R^s).

Parameters:

- `params` (map):
  - `:s` (double, required, at least `1`): the space dimension. Only `floor(s / 2)` matters (`s = 3` and `s = 2` give the same function).
  - `:k` (long, required, from `0` to `4`): the smoothness, the function is `2k` times continuously differentiable. A whole double such as `2.0` is accepted.
  - `:scale` (double, default `1.0`): the support radius.

Returns a function `r -> double`. On its support the function is a polynomial of degree `floor(s / 2) + 3k + 1`; for example `k = 1`, `s = 3` is `(1 - rho)^4 (4 rho + 1)` (value `0.1875` at `rho = 0.5`). The value at `r = 0` is `1.0`; it is symmetric, decreasing, equal to `0.0` at `abs(r) = scale` and beyond. A missing `:s` or `:k`, `:s` below 1, a negative or non-integer `:k` or `:k` above 4 throws `ex-info`.

Strictly positive definite in R^d for every `d <= s`.

See also [[wu]], [[gneiting]], [[truncated-power]], [[matern]].
raw docstring

whittakerclj

(whittaker)
(whittaker params)

Whittaker kernel family: a positive mixture of truncated powers, W(rho) / W(0) with W(rho) = integral over t >= 0 of (1 - rho t)_+^(k - 1) * t^alpha * exp(-beta t) dt and rho = r / scale.

Parameters:

  • params (map):
    • :alpha (double, required): the exponent of the power weight (alpha > -1).
    • :k (double, required, positive): the order of the truncated powers (the exponent is k - 1).
    • :beta (double, required, positive): the rate of the exponential weight.
    • :scale (double, default 1.0): length scale.

Closed forms are used for alpha equal to 0 or 1 together with k equal to 2 or 3 (whatever the numeric type of the arguments: 0, 0.0 and 1 and 1.0 are the same). Every other combination uses numerical integration (adaptive Gauss-Kronrod, tolerance 1e-6), which is much slower and less accurate.

Returns a function r -> double. The function is normalised: the value at r = 0 is 1.0. It is symmetric, positive and decreasing, and not compactly supported: for large rho it decays algebraically, like rho^(-(alpha + 1)), and underflows to 0.0 only for an enormous rho. A missing :alpha, :k or :beta throws ex-info; a non-positive :beta or :k or an :alpha not above -1 throws ex-info.

As a positive mixture of truncated powers with exponent k - 1 (see truncated-power) it is positive definite in R^d at least for d <= 2k - 3 (Askey, a sufficient condition: d = 1 for k = 2).

See also truncated-power, gaussian.

Whittaker kernel family: a positive mixture of truncated powers, `W(rho) / W(0)` with `W(rho) = integral over t >= 0 of (1 - rho t)_+^(k - 1) * t^alpha * exp(-beta t) dt` and `rho = r / scale`.

Parameters:

- `params` (map):
  - `:alpha` (double, required): the exponent of the power weight (`alpha > -1`).
  - `:k` (double, required, positive): the order of the truncated powers (the exponent is `k - 1`).
  - `:beta` (double, required, positive): the rate of the exponential weight.
  - `:scale` (double, default `1.0`): length scale.

Closed forms are used for `alpha` equal to 0 or 1 together with `k` equal to 2 or 3 (whatever the numeric type of the arguments: `0`, `0.0` and `1` and `1.0` are the same). Every other combination uses numerical integration (adaptive Gauss-Kronrod, tolerance 1e-6), which is much slower and less accurate.

Returns a function `r -> double`. The function is normalised: the value at `r = 0` is `1.0`. It is symmetric, positive and decreasing, and not compactly supported: for large `rho` it decays algebraically, like `rho^(-(alpha + 1))`, and underflows to `0.0` only for an enormous `rho`. A missing `:alpha`, `:k` or `:beta` throws `ex-info`; a non-positive `:beta` or `:k` or an `:alpha` not above `-1` throws `ex-info`.

As a positive mixture of truncated powers with exponent `k - 1` (see [[truncated-power]]) it is positive definite in R^d at least for `d <= 2k - 3` (Askey, a sufficient condition: `d = 1` for `k = 2`).

See also [[truncated-power]], [[gaussian]].
raw docstring

wuclj

(wu)
(wu params)

Wu kernel family: the compactly supported functions psi_{l,k} = D^k psi_l normalised to 1 at 0, where psi_l(rho) is the convolution of (1 - t^2)_+^l with itself evaluated at 2 rho (the integral over t of (1 - t^2)_+^l * (1 - (2 rho - t)^2)_+^l), D f(rho) = -f'(rho) / rho and rho = r / scale.

Parameters:

  • params (map):
    • :l (double, required, non-negative): the exponent of the base function.
    • :k (long, required, non-negative): the number of D steps. A whole double such as 2.0 is accepted (the presets do that).
    • :scale (double, default 1.0): the support radius.

Closed form polynomials are used for an integer l from 0 to 3 and k from 0 to l (whatever the numeric type of the arguments: 2, 2.0 are the same). Their values equal the exact rational ones to about 1e-14. For other combinations (a larger or non-integer l, or k above l) the base function is integrated and differentiated numerically (Gauss-Kronrod and finite differences): this is accurate for k = 0, but unstable for k >= 2 (errors grow quickly with k, up to garbage for k >= 3), so prefer the closed forms.

Returns a function r -> double. The value at r = 0 is 1.0; it is symmetric, equal to 0.0 at abs(r) = scale and beyond. A missing :l or :k, a negative :l or :k or a non-integer :k throws ex-info.

Positive definite in R^d for d <= 2k + 1 (the closed forms).

See also wendland, gneiting, truncated-power.

Wu kernel family: the compactly supported functions `psi_{l,k} = D^k psi_l` normalised to `1` at `0`, where `psi_l(rho)` is the convolution of `(1 - t^2)_+^l` with itself evaluated at `2 rho` (the integral over t of `(1 - t^2)_+^l * (1 - (2 rho - t)^2)_+^l`), `D f(rho) = -f'(rho) / rho` and `rho = r / scale`.

Parameters:

- `params` (map):
  - `:l` (double, required, non-negative): the exponent of the base function.
  - `:k` (long, required, non-negative): the number of `D` steps. A whole double such as `2.0` is accepted (the presets do that).
  - `:scale` (double, default `1.0`): the support radius.

Closed form polynomials are used for an integer `l` from 0 to 3 and `k` from 0 to `l` (whatever the numeric type of the arguments: `2`, `2.0` are the same). Their values equal the exact rational ones to about 1e-14. For other combinations (a larger or non-integer `l`, or `k` above `l`) the base function is integrated and differentiated numerically (Gauss-Kronrod and finite differences): this is accurate for `k = 0`, but unstable for `k >= 2` (errors grow quickly with `k`, up to garbage for `k >= 3`), so prefer the closed forms.

Returns a function `r -> double`. The value at `r = 0` is `1.0`; it is symmetric, equal to `0.0` at `abs(r) = scale` and beyond. A missing `:l` or `:k`, a negative `:l` or `:k` or a non-integer `:k` throws `ex-info`.

Positive definite in R^d for `d <= 2k + 1` (the closed forms).

See also [[wendland]], [[gneiting]], [[truncated-power]].
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close