aboutsummaryrefslogtreecommitdiff
path: root/lamp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lamp.cpp')
-rw-r--r--lamp.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lamp.cpp b/lamp.cpp
index 90be140..b7a1027 100644
--- a/lamp.cpp
+++ b/lamp.cpp
@@ -2,6 +2,8 @@
#include <algorithm>
+static const double EPSILON = 1e-3;
+
arma::mat mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::mat &Ys)
{
arma::mat projection(X.n_rows, 2);
@@ -22,7 +24,7 @@ void mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::m
arma::rowvec alphas(sampleSize);
for (arma::uword j = 0; j < sampleSize; j++) {
double dist = arma::accu(arma::square(Xs.row(j) - point));
- alphas[j] = 1. / std::max(dist, mp::EPSILON);
+ alphas[j] = 1. / std::max(dist, EPSILON);
}
double alphas_sum = arma::accu(alphas);