-<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Custom Kernels · KernelFunctions</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">KernelFunctions</span></div><form class="docs-search" action="../search/"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><a class="tocitem" href="../userguide/">User Guide</a></li><li><a class="tocitem" href="../example/">Examples</a></li><li><a class="tocitem" href="../kernels/">Kernel Functions</a></li><li><a class="tocitem" href="../transform/">Transform</a></li><li><a class="tocitem" href="../metrics/">Metrics</a></li><li><a class="tocitem" href="../theory/">Theory</a></li><li class="is-active"><a class="tocitem" href>Custom Kernels</a><ul class="internal"><li><a class="tocitem" href="#Creating-your-own-kernel"><span>Creating your own kernel</span></a></li></ul></li><li><a class="tocitem" href="../api/">API</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Custom Kernels</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Custom Kernels</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/blob/master/docs/src/create_kernel.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h2 id="Creating-your-own-kernel"><a class="docs-heading-anchor" href="#Creating-your-own-kernel">Creating your own kernel</a><a id="Creating-your-own-kernel-1"></a><a class="docs-heading-anchor-permalink" href="#Creating-your-own-kernel" title="Permalink"></a></h2><p>KernelFunctions.jl contains the most popular kernels already but you might want to make your own!</p><p>Here are a few ways depending on how complicated your kernel is :</p><h3 id="SimpleKernel-for-kernels-function-depending-on-a-metric"><a class="docs-heading-anchor" href="#SimpleKernel-for-kernels-function-depending-on-a-metric">SimpleKernel for kernels function depending on a metric</a><a id="SimpleKernel-for-kernels-function-depending-on-a-metric-1"></a><a class="docs-heading-anchor-permalink" href="#SimpleKernel-for-kernels-function-depending-on-a-metric" title="Permalink"></a></h3><p>If your kernel function is of the form <code>k(x, y) = f(d(x, y))</code> where <code>d(x, y)</code> is a <code>PreMetric</code>, you can construct your custom kernel by defining <code>kappa</code> and <code>metric</code> for your kernel. Here is for example how one can define the <code>SqExponentialKernel</code> again :</p><pre><code class="language-julia">struct MyKernel <: KernelFunctions.SimpleKernel end
0 commit comments