From 6da67a32e56c101b9334d2c6f33bd5238d082330 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Fri, 24 Jul 2015 13:01:16 -0300 Subject: Color mapping in Scatterplot and initial measures. - Scatterplot: can now map any floating point data to colors; - Scatterplot: somewhat optimized geometry/material updates; - Removed anything related to labels where it was not necessary; - Added observers to implement distortion (via measures) visualization; - Added skeleton implementations of NP and silhouette. --- mp.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'mp.h') diff --git a/mp.h b/mp.h index 7d6b535..a9ddd38 100644 --- a/mp.h +++ b/mp.h @@ -1,10 +1,21 @@ +#ifndef MP_H +#define MP_H + #include namespace mp { +// --- Distance-related +typedef double (*DistFunc)(const arma::rowvec &, const arma::rowvec &); double euclidean(const arma::rowvec &x1, const arma::rowvec &x2); -arma::mat dist(const arma::mat &X, double (*distCalc)(const arma::rowvec &, const arma::rowvec &) = euclidean); +arma::mat dist(const arma::mat &X, DistFunc dfunc = euclidean); + +// --- Evaluation measures +typedef arma::vec (*MeasureFunc)(const arma::mat &distA, const arma::mat &distB); +arma::vec neighborhoodPreservation(const arma::mat &distA, const arma::mat &distB, int k = 10); +arma::vec silhouette(const arma::mat &distA, const arma::mat &distB, const arma::vec &labels); +// --- Techniques arma::mat lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::mat &Ys); void lamp(const arma::mat &X, const arma::uvec &sampleIndices, const arma::mat &Ys, arma::mat &Y); @@ -14,3 +25,5 @@ arma::mat tSNE(const arma::mat &X, arma::uword k = 2, double perplexity = 30, ar void tSNE(const arma::mat &X, arma::mat &Y, double perplexity = 30, arma::uword nIter = 1000); } // namespace mp + +#endif // MP_H -- cgit v1.2.3