gdkrmr / dimRed

A Framework for Dimensionality Reduction in R
https://www.guido-kraemer.com/software/dimred/
GNU General Public License v3.0
73 stars 15 forks source link

Inverse function for tsne and umap #48

Closed nikitagupta0809 closed 4 years ago

nikitagupta0809 commented 4 years ago

Hi, I am trying to find the reconstruction error for umap and tsne. I get this error.

ir <- loadDataSet("3D S Curve")
ir.umap <- embed(ir, "UMAP", ndim = ndims(ir))
ir.tsne <- embed(ir, "tSNE", ndim = ndims(ir))
rmse <- data.frame(
rmse_umap = reconstruction_error(ir.umap),
rmse_tsne = reconstruction_error(ir.tsne)
)
matplot(rmse, type = "l")
plot(ir)
plot(ir.umap)
plot(ir.tsne)

This gives me an error: Error in .local(object, ...): object does not have an inverse function Traceback:

data.frame(rmse_umap = reconstruction_error(ir.umap), rmse_tsne = reconstruction_error(ir.tsne)) reconstruction_error(ir.umap) reconstruction_error(ir.umap) .local(object, ...) getData(inverse(object, getData(getDimRedData(object))[, seq_len(n[i]), . drop = FALSE])) inverse(object, getData(getDimRedData(object))[, seq_len(n[i]), . drop = FALSE]) inverse(object, getData(getDimRedData(object))[, seq_len(n[i]), . drop = FALSE]) .local(object, ...) stop("object does not have an inverse function")

Please let me know where am I going wrong/ how to fix this issue. Thanks!

gdkrmr commented 4 years ago

there is no inverse function for UMAP, therefore no reconstruction and no reconstruction error.