From aafe95583dd1464aa6069de07a09bd6b423bf644 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Wed, 31 Aug 2016 09:48:24 -0300 Subject: Removed labels handling and bundling when selecting regular points. --- main.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 8cc9323..5f7693d 100644 --- a/main.cpp +++ b/main.cpp @@ -43,6 +43,18 @@ arma::uvec extractCPs(const arma::mat &X) return indices.subvec(0, numCPs-1); } +arma::mat standardize(const arma::mat &X) +{ + arma::mat stdX = X; + for (arma::uword j = 0; j < X.n_cols; j++) { + double sd = arma::stddev(stdX.col(j)); + double mean = arma::mean(stdX.col(j)); + stdX.col(j) = (stdX.col(j) - mean) / sd; + } + + return stdX; +} + void overviewBundles(const Main *m) { const arma::mat &unreliability = m->projectionHistory->unreliability(); @@ -105,8 +117,7 @@ int main(int argc, char **argv) return 1; } - const arma::mat &X = m->X(); - //arma::vec labels = m->labels(); + const arma::mat &X = standardize(m->X()); arma::arma_rng::set_seed(RNG_SEED); arma::uvec cpIndices; @@ -121,6 +132,7 @@ int main(int argc, char **argv) if (indicesFile.exists()) { m->setIndicesSavePath(indicesFilename); cpIndices.load(indicesFilename.toStdString(), arma::raw_ascii); + cpIndices -= 1; } else { std::cerr << "No indices file, generating indices...\n"; cpIndices = extractCPs(X); @@ -147,6 +159,10 @@ int main(int argc, char **argv) return 1; } + // TODO: maybe put this inside m->setCP() method; for now, will be outside + // for more flexibility + Ys = arma::normalise(Ys); + // Sort indices (some operations become easier later) arma::uvec cpSortedIndices = arma::sort_index(cpIndices); cpIndices = cpIndices(cpSortedIndices); @@ -262,7 +278,7 @@ int main(int argc, char **argv) // Only the 10% largest values, filtered by the selected RPs const arma::mat &unreliability = m->projectionHistory->unreliability(); arma::uvec indicesLargest = arma::sort_index(unreliability.cols(selectedCPs), "descending"); - arma::uword numLargest = indicesLargest.n_elem * 0.1f; + arma::uword numLargest = indicesLargest.n_elem * 0.01f; indicesLargest = indicesLargest.subvec(0, numLargest-1); m->bundlePlot->setValues(unreliability(indicesLargest)); @@ -293,7 +309,8 @@ int main(int argc, char **argv) m->rpPlot, &Scatterplot::setSelection); QObject::connect(&rpSelectionHandler, &SelectionHandler::selectionChanged, m->rpBarChart, &BarChart::setSelection); - QObject::connect(&rpSelectionHandler, &SelectionHandler::selectionChanged, + // This still needs more tests + /*QObject::connect(&rpSelectionHandler, &SelectionHandler::selectionChanged, [m](const std::vector &rpSelection) { // given some RPs, see unexpected CPs *influencing* them std::vector selectedRPIndices; @@ -315,7 +332,7 @@ int main(int argc, char **argv) // Only the 10% largest values, filtered by the selected RPs const arma::mat &unreliability = m->projectionHistory->unreliability(); arma::uvec indicesLargest = arma::sort_index(unreliability.rows(selectedRPs), "descending"); - arma::uword numLargest = indicesLargest.n_elem * 0.1f; + arma::uword numLargest = indicesLargest.n_elem * 0.01f; indicesLargest = indicesLargest.subvec(0, numLargest-1); m->bundlePlot->setValues(unreliability(indicesLargest)); @@ -335,7 +352,7 @@ int main(int argc, char **argv) indices[2*i + 1] = RPs(i); } m->bundlePlot->setLines(indices, m->projectionHistory->Y()); - }); + });*/ // Brushing between each bar chart and respective scatterplot BrushingHandler cpBrushHandler; -- cgit v1.2.3