|
| LaplacianKernel () |
| Default constructor; sets bandwidth to 1.0.
|
|
| LaplacianKernel (double bandwidth) |
| Construct the Laplacian kernel with a custom bandwidth. More...
|
|
template<typename VecTypeA , typename VecTypeB > |
double | Evaluate (const VecTypeA &a, const VecTypeB &b) const |
| Evaluation of the Laplacian kernel. More...
|
|
double | Evaluate (const double t) const |
| Evaluation of the Laplacian kernel given the distance between two points. More...
|
|
double | Gradient (const double t) const |
| Evaluation of the gradient of the Laplacian kernel given the distance between two points. More...
|
|
double | Bandwidth () const |
| Get the bandwidth.
|
|
double & | Bandwidth () |
| Modify the bandwidth.
|
|
template<typename Archive > |
void | serialize (Archive &ar, const uint32_t) |
| Serialize the kernel.
|
|
The standard Laplacian kernel.
Given two vectors \( x \), \( y \), and a bandwidth \( \mu \) (set in the constructor),
\[ K(x, y) = \exp(-\frac{|| x - y ||}{\mu}). \]
The implementation is all in the header file because it is so simple.
template<typename VecTypeA , typename VecTypeB >
double mlpack::kernel::LaplacianKernel::Evaluate |
( |
const VecTypeA & |
a, |
|
|
const VecTypeB & |
b |
|
) |
| const |
|
inline |
Evaluation of the Laplacian kernel.
This could be generalized to use any distance metric, not the Euclidean distance, but for now, the Euclidean distance is used.
- Template Parameters
-
VecTypeA | Type of first vector (likely arma::vec or arma::sp_vec). |
VecTypeB | Type of second vector (arma::vec / arma::sp_vec). |
- Parameters
-
a | First vector. |
b | Second vector. |
- Returns
- K(a, b) using the bandwidth ( \(\mu\)) specified in the constructor.