docs/exported-data.md

title: "Exported Data" output: html_document: theme: cosmo toc: true toc_float: collapsed: false

Previous: Reporting. Next:Analysis. Up: Index.

sneer return value

Having run an embedding:

iris_tsne <- sneer(iris)

what exactly does iris_tsne give you? It's a list with something like the following:

nf and ng only count the function and gradient values with respect to the error in the coordinates. Extra function and gradient evaluations made as part of optimizing "dynamic" parameters, if they were optimized separately from the coordinates (i.e. you set alt_opt = TRUE), are not included here. See the Embedding Methods section for details on which methods are (or can be made) dynamic in this way. See the section on the dyn return value below to get these separate function and gradient counts.

ret

You can also ask for some other data. Some of it might be useful for diagnostics, debugging, visualization or as input to another algorithm. To get access to it, pass a vector of names to the ret parameter.

The names you can ask for are:

For every name you provide, the list returned by sneer will contain an extra item in the list with the same name. If you ask for an item that doesn't make sense, e.g. a probability matrix from an embedding method that never calculated one, the request is silently ignored. Otherwise, the value will be calculated if possible, e.g. even though degree centrality is only used in ws-SNE, you can ask for it to be returned from any probability-based embedding, because it's related to the input probabilities, so it can be calculated.

# return the point-wise cost function, output distance matrix and the degree centrality
# in tsne_iris$dy and tsne_iris$deg, respectively
tsne_iris <- sneer(iris, ret = c("pcost", "dy", "deg"))

# returns the output distance matrix in sammon_iris$dy, but no
# sammon_iris$deg, because that would require the presence of data that
# Sammon Mapping doesn't create
sammon_iris <- sneer(iris, ret = c("dy", "deg"))

Although sneer requires input distance matrix data to be of class dist, internally, it uses objects of class matrix for all matrices, even distance matrices. So dy and dx will be of class matrix. If you want to pass dy or dx back into sneer for some crazy scheme or other, you will need to cast them into dist objects via as.dist:

s1k_tsne <- sneer(s1k, ret = c("dy"))
# ... work some unseen magic on s1k_tsne$dy ...
# return it to sneer for more processing
s1k_mmds <- sneer(as.dist(s1k_tsne$dy), method = "mmds", labels = s1k$Label)

You may find some use for the numerical vectors that can be returned with ret by coloring the embedding plot based on their magnitude. The Visualization section can tell you more.

Previous: Reporting. Next:Analysis. Up: Index.



jlmelville/sneer documentation built on Nov. 15, 2022, 8:13 a.m.