diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2015-05-30 02:00:08 -0300 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2015-05-30 02:00:08 -0300 |
commit | 4e0b46a727f6ea727b9e7920150609c58ce65fce (patch) | |
tree | 9ef92bc738950fdb40a4a89ccb262f82a7551646 /lamp.cpp | |
parent | 992ad77b19550b0db4c0d992683509e2b4266374 (diff) |
Added tSNE. Code improvements.
Diffstat (limited to 'lamp.cpp')
-rw-r--r-- | lamp.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |