diff options
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); +} |