aboutsummaryrefslogtreecommitdiff
path: root/lamp.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2015-05-30 02:00:08 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2015-05-30 02:00:08 -0300
commit4e0b46a727f6ea727b9e7920150609c58ce65fce (patch)
tree9ef92bc738950fdb40a4a89ccb262f82a7551646 /lamp.cpp
parent992ad77b19550b0db4c0d992683509e2b4266374 (diff)
Added tSNE. Code improvements.
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);