aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-08-31 09:45:48 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2016-08-31 09:45:48 -0300
commita6d4502071ab708d4b06d58a737e51b1df99b459 (patch)
tree77ead0c3afb1f4d755630b3459ac0781bec5cb86
parent89d7b0aa1bfa1672f84cbfb383750c7759bc396e (diff)
Updated LAMP code.
-rw-r--r--lamp.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lamp.cpp b/lamp.cpp
index 77bbac4..9b06026 100644
--- a/lamp.cpp
+++ b/lamp.cpp
@@ -4,7 +4,7 @@
#include "utils.h"
-static const double EPSILON = 1e-3;
+static const double EPSILON = 1e-6;
arma::mat mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::mat &Ys)
{
@@ -50,12 +50,12 @@ void mp::lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::m
arma::mat &B = Yhat;
B.each_col() %= alphas.t();
- arma::mat U(Ys.n_rows, Ys.n_cols), V(Ys.n_cols, Ys.n_cols);
+ arma::mat U, V;
arma::vec s(Ys.n_cols);
arma::svd(U, s, V, At * B);
- arma::mat M = U.cols(0, 1) * V.t();
+ arma::mat M = U.head_cols(Ys.n_cols) * V.t();
- Y(i, arma::span(0, 1)) = (point - Xtil) * M + Ytil;
+ Y.row(i) = (point - Xtil) * M + Ytil;
}
for (arma::uword i = 0; i < sampleSize; i++) {