class gpr::bo::ScaledEuclideanDistance¶
Overview¶
Squared Euclidean distance with one length scale, or one per coordinate. More…
#include <gpr/bo/StationaryKernel.h>
class ScaledEuclideanDistance {
public:
// construction
ScaledEuclideanDistance(Eigen::VectorXd length_scales);
ScaledEuclideanDistance(Eigen::VectorXd length_scales, std::vector<bool> categorical);
// methods
template <typename Left, typename Right>
double squared(const Left& left, const Right& right) const;
const std::vector<bool>& categorical() const;
const Eigen::VectorXd& lengthScales() const;
};
Detailed Documentation¶
Squared Euclidean distance with one length scale, or one per coordinate.
Construction¶
ScaledEuclideanDistance(Eigen::VectorXd length_scales, std::vector<bool> categorical)
Distance with unordered coordinates.
A coordinate whose categorical entry is true holds a label. Two rows are then zero apart on that coordinate when the labels are equal and one length-scale unit apart otherwise, so the term is (a != b) / l^2. That is the squared Euclidean distance of a one-hot encoding up to a factor two in l^2, so a radial kernel of it stays positive definite. categorical has one entry per length scale.
Methods¶
template <typename Left, typename Right>
double squared(const Left& left, const Right& right) const
One stored scale applies to every coordinate. Otherwise the count matches the vector.
const std::vector<bool>& categorical() const
Unordered-coordinate flags. Empty: every coordinate is ordered.
const Eigen::VectorXd& lengthScales() const
The stored length scales: one, or one per coordinate.