Repository: cornellius-gp/gpytorch

Issue:
[Docs]MaternKernel formula
The documentation for the [Matern Kernel](https://docs.gpytorch.ai/en/stable/kernels.html#maternkernel) says that the Matern kernel is

<img src=
"https://render.githubusercontent.com/render/math?math=%5Cdisplaystyle+%5Cbegin%7Bequation%2A%7D%0A+++k_%7B%5Ctext%7BMatern%7D%7D%28%5Cmathbf%7Bx_1%7D%2C+%5Cmathbf%7Bx_2%7D%29+%3D+%5Cfrac%7B2%5E%7B1+-+%5Cnu%7D%7D%7B%5CGamma%28%5Cnu%29%7D%0A+++%5Cleft%28+%5Csqrt%7B2+%5Cnu%7D+d+%5Cright%29+K_%5Cnu+%5Cleft%28+%5Csqrt%7B2+%5Cnu%7D+d+%5Cright%29%0A%5Cend%7Bequation%2A%7D%0A" 
alt="\begin{equation*}
   k_{\text{Matern}}(\mathbf{x_1}, \mathbf{x_2}) = \frac{2^{1 - \nu}}{\Gamma(\nu)}
   \left( \sqrt{2 \nu} d \right) K_\nu \left( \sqrt{2 \nu} d \right)
\end{equation*}
">

but I suspect that the usual Matern kernel (such as described [here](https://en.wikipedia.org/wiki/Matérn_covariance_function)) is 

<img src=
"https://render.githubusercontent.com/render/math?math=%5Cdisplaystyle+%5Cbegin%7Bequation%2A%7D%0A+++k_%7B%5Ctext%7BMatern%7D%7D%28%5Cmathbf%7Bx_1%7D%2C+%5Cmathbf%7Bx_2%7D%29+%3D+%5Cfrac%7B2%5E%7B1+-+%5Cnu%7D%7D%7B%5CGamma%28%5Cnu%29%7D%0A+++%5Cleft%28+%5Csqrt%7B2+%5Cnu%7D+d+%5Cright%29%5E%5Cnu+K_%5Cnu+%5Cleft%28+%5Csqrt%7B2+%5Cnu%7D+d+%5Cright%29%0A%5Cend%7Bequation%2A%7D%0A" 
alt="\begin{equation*}
   k_{\text{Matern}}(\mathbf{x_1}, \mathbf{x_2}) = \frac{2^{1 - \nu}}{\Gamma(\nu)}
   \left( \sqrt{2 \nu} d \right)^\nu K_\nu \left( \sqrt{2 \nu} d \right)
\end{equation*}
">

Is it mistake of documentation, or the implementation of GPyTorch is different from others? 



Discussion:
Mistake in documentation. If you could put up a PR fixing this, that'd be great.
Thanks. Should I fix the docstrings in https://github.com/hayato-n/gpytorch/blob/master/gpytorch/kernels/matern_kernel.py ?

Resolving patch:
diff --git a/gpytorch/kernels/matern_kernel.py b/gpytorch/kernels/matern_kernel.py
--- a/gpytorch/kernels/matern_kernel.py
+++ b/gpytorch/kernels/matern_kernel.py
@@ -18,7 +18,7 @@ class MaternKernel(Kernel):
 
        \begin{equation*}
           k_{\text{Matern}}(\mathbf{x_1}, \mathbf{x_2}) = \frac{2^{1 - \nu}}{\Gamma(\nu)}
-          \left( \sqrt{2 \nu} d \right) K_\nu \left( \sqrt{2 \nu} d \right)
+          \left( \sqrt{2 \nu} d \right)^{\nu} K_\nu \left( \sqrt{2 \nu} d \right)
        \end{equation*}
 
     where
@@ -37,30 +37,29 @@ class MaternKernel(Kernel):
         This kernel does not have an `outputscale` parameter. To add a scaling parameter,
         decorate this kernel with a :class:`gpytorch.kernels.ScaleKernel`.
 
-    Args:
-        :attr:`nu` (float):
-            The smoothness parameter: either 1/2, 3/2, or 5/2.
-        :attr:`ard_num_dims` (int, optional):
-            Set this if you want a separate lengthscale for each
-            input dimension. It should be `d` if :attr:`x1` is a `n x d` matrix. Default: `None`
-        :attr:`batch_shape` (torch.Size, optional):
-            Set this if you want a separate lengthscale for each
-             batch of input data. It should be `b` if :attr:`x1` is a `b x n x d` tensor. Default: `torch.Size([])`
-        :attr:`active_dims` (tuple of ints, optional):
-            Set this if you want to
-            compute the covariance of only a few input dimensions. The ints
-            corresponds to the indices of the dimensions. Default: `None`.
-        :attr:`lengthscale_prior` (Prior, optional):
-            Set this if you want to apply a prior to the lengthscale parameter.  Default: `None`
-        :attr:`lengthscale_constraint` (Constraint, optional):
-            Set this if you want to apply a constraint to the lengthscale parameter. Default: `Positive`.
-        :attr:`eps` (float):
-            The minimum value that the lengthscale can take (prevents divide by zero errors). Default: `1e-6`.
-
-    Attributes:
-        :attr:`lengthscale` (Tensor):
-            The lengthscale parameter. Size/shape of parameter depends on the
-            :attr:`ard_num_dims` and :attr:`batch_shape` arguments.
+    :param nu: (Default: 2.5) The smoothness parameter.
+    :type nu: float (0.5, 1.5, or 2.5)
+    :param ard_num_dims: (Default: `None`) Set this if you want a separate lengthscale for each
+        input dimension. It should be `d` if :attr:`x1` is a `... x n x d` matrix.
+    :type ard_num_dims: int, optional
+    :param batch_shape: (Default: `None`) Set this if you want a separate lengthscale for each
+         batch of input data. It should be `torch.Size([b1, b2])` for a `b1 x b2 x n x m` kernel output.
+    :type batch_shape: torch.Size, optional
+    :param active_dims: (Default: `None`) Set this if you want to
+        compute the covariance of only a few input dimensions. The ints
+        corresponds to the indices of the dimensions.
+    :type active_dims: Tuple(int)
+    :param lengthscale_prior: (Default: `None`)
+        Set this if you want to apply a prior to the lengthscale parameter.
+    :type lengthscale_prior: ~gpytorch.priors.Prior, optional
+    :param lengthscale_constraint: (Default: `Positive`) Set this if you want
+        to apply a constraint to the lengthscale parameter.
+    :type lengthscale_constraint: ~gpytorch.constraints.Interval, optional
+    :param eps: (Default: 1e-6) The minimum value that the lengthscale can take (prevents divide by zero errors).
+    :type eps: float, optional
+
+    :var torch.Tensor lengthscale: The lengthscale parameter. Size/shape of parameter depends on the
+        :attr:`ard_num_dims` and :attr:`batch_shape` arguments.
 
     Example:
         >>> x = torch.randn(10, 5)


Test patch: