.TH "mlpack::kernel::ExampleKernel" 3 "Tue Sep 9 2014" "Version 1.0.10" "MLPACK" \" -*- nroff -*- .ad l .nh .SH NAME mlpack::kernel::ExampleKernel \- .PP An example kernel function\&. .SH SYNOPSIS .br .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBExampleKernel\fP ()" .br .RI "\fIThe default constructor, which takes no parameters\&. \fP" .ti -1c .RI "std::string \fBToString\fP () const " .br .RI "\fIReturns a string for the kernel object; in this case, with only the memory address for the kernel\&. \fP" .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "template static double \fBConvolutionIntegral\fP (const VecType &a, const VecType &b)" .br .RI "\fIObtains the convolution integral [integral K(||x-a||)K(||b-x||)dx] for the two vectors\&. \fP" .ti -1c .RI "template static double \fBEvaluate\fP (const VecType &a, const VecType &b)" .br .RI "\fIEvaluates the kernel function for two given vectors\&. \fP" .ti -1c .RI "static double \fBNormalizer\fP ()" .br .RI "\fIObtains the normalizing volume for the kernel with dimension $dimension$\&. \fP" .in -1c .SH "Detailed Description" .PP An example kernel function\&. This is not a useful kernel, but it implements the two functions necessary to satisfy the Kernel policy (so that a class can be used whenever an MLPACK method calls for a \fCtypename Kernel\fP template parameter\&. .PP All that is necessary is a constructor and an \fC\fBEvaluate()\fP\fP function\&. More methods could be added; for instance, one useful idea is a constructor which takes parameters for a kernel (for instance, the width of the Gaussian for a Gaussian kernel)\&. However, MLPACK methods cannot count on these various constructors existing, which is why most methods allow passing an already-instantiated kernel object (and by default the method will construct the kernel with the default constructor)\&. So, for instance, .PP .PP .nf GaussianKernel k(5\&.0); KDE kde(dataset, k); .fi .PP .PP will set up KDE using a Gaussian kernel with a width of 5\&.0, but .PP .PP .nf KDE kde(dataset); .fi .PP .PP will create the kernel with the default constructor\&. It is important (but not strictly mandatory) that your default constructor still gives a working kernel\&. .PP \fBNote:\fP .RS 4 Not all kernels require state\&. For instance, the regular dot product needs no parameters\&. In that case, no local variables are necessary and \fC\fBEvaluate()\fP\fP can (and should) be declared static\&. However, for greater generalization, MLPACK methods expect all kernels to require state and hence must store instantiated kernel functions; this is why a default constructor is necessary\&. .RE .PP .PP Definition at line 94 of file example_kernel\&.hpp\&. .SH "Constructor & Destructor Documentation" .PP .SS "mlpack::kernel::ExampleKernel::ExampleKernel ()\fC [inline]\fP" .PP The default constructor, which takes no parameters\&. Because our simple example kernel has no internal parameters that need to be stored, the constructor does not need to do anything\&. For a more complex example, see the \fBGaussianKernel\fP, which stores an internal parameter\&. .PP Definition at line 103 of file example_kernel\&.hpp\&. .SH "Member Function Documentation" .PP .SS "template static double mlpack::kernel::ExampleKernel::ConvolutionIntegral (const VecType &a, const VecType &b)\fC [inline]\fP, \fC [static]\fP" .PP Obtains the convolution integral [integral K(||x-a||)K(||b-x||)dx] for the two vectors\&. In this case, because our simple example kernel has no internal parameters, we can declare the function static\&. For a more complex example which cannot be declared static, see the \fBGaussianKernel\fP, which stores an internal parameter\&. .PP \fBTemplate Parameters:\fP .RS 4 \fIVecType\fP Type of vector (arma::vec, arma::spvec should be expected)\&. .RE .PP \fBParameters:\fP .RS 4 \fIa\fP First vector\&. .br \fIb\fP Second vector\&. .RE .PP \fBReturns:\fP .RS 4 the convolution integral value\&. .RE .PP .PP Definition at line 144 of file example_kernel\&.hpp\&. .SS "template static double mlpack::kernel::ExampleKernel::Evaluate (const VecType &a, const VecType &b)\fC [inline]\fP, \fC [static]\fP" .PP Evaluates the kernel function for two given vectors\&. In this case, because our simple example kernel has no internal parameters, we can declare the function static\&. For a more complex example which cannot be declared static, see the \fBGaussianKernel\fP, which stores an internal parameter\&. .PP \fBTemplate Parameters:\fP .RS 4 \fIVecType\fP Type of vector (arma::vec, arma::spvec should be expected)\&. .RE .PP \fBParameters:\fP .RS 4 \fIa\fP First vector\&. .br \fIb\fP Second vector\&. .RE .PP \fBReturns:\fP .RS 4 K(a, b)\&. .RE .PP .PP Definition at line 117 of file example_kernel\&.hpp\&. .SS "static double mlpack::kernel::ExampleKernel::Normalizer ()\fC [inline]\fP, \fC [static]\fP" .PP Obtains the normalizing volume for the kernel with dimension $dimension$\&. In this case, because our simple example kernel has no internal parameters, we can declare the function static\&. For a more complex example which cannot be declared static, see the \fBGaussianKernel\fP, which stores an internal parameter\&. .PP \fBParameters:\fP .RS 4 \fIdimension\fP the dimension of the space\&. .RE .PP \fBReturns:\fP .RS 4 the normalization constant\&. .RE .PP .PP Definition at line 157 of file example_kernel\&.hpp\&. .SS "std::string mlpack::kernel::ExampleKernel::ToString () const\fC [inline]\fP" .PP Returns a string for the kernel object; in this case, with only the memory address for the kernel\&. If your kernel has any members, your \fBToString()\fP method should include those as necessary as well\&. .PP Definition at line 124 of file example_kernel\&.hpp\&. .SH "Author" .PP Generated automatically by Doxygen for MLPACK from the source code\&.