# SVGDKernel { #phasic.svgd.SVGDKernel }

```python
phasic.svgd.SVGDKernel(bandwidth='median_per_dim', preconditioner=None)
```

RBF kernel for SVGD with automatic bandwidth selection.

## Parameters {.doc-section .doc-section-parameters}

<code>[**bandwidth**]{.parameter-name} [:]{.parameter-annotation-sep} [[str](`str`) or [float](`float`) or [jnp](`jax.numpy`).[ndarray](`jax.numpy.ndarray`)]{.parameter-annotation} [ = ]{.parameter-default-sep} [\'median_per_dim\']{.parameter-default}</code>

:   Bandwidth selection method or fixed value.

<code>[**preconditioner**]{.parameter-name} [:]{.parameter-annotation-sep} [[_PreconditionerBase](`phasic.svgd._PreconditionerBase`) or None]{.parameter-annotation} [ = ]{.parameter-default-sep} [None]{.parameter-default}</code>

:   Optional preconditioner for normalizing particle space.

## Methods

| Name | Description |
| --- | --- |
| [compute_kernel_grad](#phasic.svgd.SVGDKernel.compute_kernel_grad) | Compute RBF kernel matrix and its gradient (JIT-compiled) |

### compute_kernel_grad { #phasic.svgd.SVGDKernel.compute_kernel_grad }

```python
phasic.svgd.SVGDKernel.compute_kernel_grad(particles)
```

Compute RBF kernel matrix and its gradient (JIT-compiled)

#### Parameters {.doc-section .doc-section-parameters}

<code>[**particles**]{.parameter-name} [:]{.parameter-annotation-sep} [[jnp](`jax.numpy`).[ndarray](`jax.numpy.ndarray`)]{.parameter-annotation}</code>

:   Current particle positions, shape ``(n_particles, theta_dim)``.

#### Returns {.doc-section .doc-section-returns}

<code>[**K**]{.parameter-name} [:]{.parameter-annotation-sep} [[jnp](`jax.numpy`).[ndarray](`jax.numpy.ndarray`)]{.parameter-annotation}</code>

:   Kernel matrix, shape ``(n_particles, n_particles)``.

<code>[**grad_K**]{.parameter-name} [:]{.parameter-annotation-sep} [[jnp](`jax.numpy`).[ndarray](`jax.numpy.ndarray`)]{.parameter-annotation}</code>

:   Gradient of kernel matrix w.r.t. original (unnormalized) particles, shape ``(n_particles, n_particles, theta_dim)``.