The idea is to measure the effectiveness of dimension reduction methods by computing a measure using the nearest neighbors of a point in the original space and the reduced space. Currently, "jaccard" is implemented.

dr_measure(ldData, d, measure = "jaccard", ...)

Arguments

ldData

(numeric matrix) Dimension reduced data

d

('dist' object) Distances between points in the original space

measure

Currently, "jaccard" is implemented

...

Additional arguments to be passed to kNN

Details

The metric used to compute distances on dimension reduced data is always euclidean.

Examples

d_full <- stats::dist(iris[,1:4]) newData <- stats::cmdscale(d_full) newData_tsne <- Rtsne::Rtsne(d_full, is_distance = TRUE)[["Y"]] vec <- dr_measure(newData, d_full, k = 10) summary(vec)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 0.1111 0.4560 0.5385 0.6061 0.7803 1.0000
plot(stats::density(vec))
vec_tsne <- dr_measure(newData_tsne, d_full, k = 10) summary(vec_tsne)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 0.1765 0.5385 0.6667 0.6542 0.8182 1.0000
plot(stats::density(vec_tsne))