diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2015-05-20 18:53:07 -0300 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2015-05-20 18:53:07 -0300 |
commit | 07eb2224a70e29683ec9fd5008662ede32c05639 (patch) | |
tree | 024ee0050cf68534b2e977d48c266303a2c9bdc8 /interactionhandler.cpp | |
parent | ecc6ada9f64a9858f29b5da2e733fec0ec6f8bad (diff) |
Nearly complete implementation of interaction.
Interaction still does not work due to signals not being correctly emitted.
Diffstat (limited to 'interactionhandler.cpp')
-rw-r--r-- | interactionhandler.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/interactionhandler.cpp b/interactionhandler.cpp new file mode 100644 index 0000000..fab3c75 --- /dev/null +++ b/interactionhandler.cpp @@ -0,0 +1,31 @@ +#include "interactionhandler.h" + +#include "mp.h" + +InteractionHandler::InteractionHandler(const arma::mat &X, + const arma::vec &labels, + const arma::uvec &sampleIndices) + : m_X(X) + , m_labels(labels) + , m_sampleIndices(sampleIndices) + , m_technique(TECHNIQUE_LAMP) +{ +} + +void InteractionHandler::setSubsample(const arma::mat &Ys) +{ + arma::mat embedding(m_X.n_rows, Ys.n_cols); + switch (m_technique) { + case TECHNIQUE_PLMP: + case TECHNIQUE_LSP: + case TECHNIQUE_LAMP: + embedding = mp::lamp(m_X, m_sampleIndices, Ys); + break; + } + + arma::mat Y(embedding.n_rows, embedding.n_cols); + Y.cols(0, embedding.n_cols - 1) = embedding; + Y.col(Y.n_cols - 1) = m_labels; + + emit subsampleChanged(Y); +} |