# Calculate the average of a set of distance matrix generated by t-SNE runs on the same data set
DistConsensus <- function(ts, adj=NA) {
# ts A list of tSNE matrix
# adj Rescaling factor, a vector of positive number with the same length of <ts> if not NA
d0 <- dist(ts[[1]]);
if (!identical(NA, adj) & length(adj)==length(ts)) d0 <- adj[1]*d0;
for (i in 2:length(ts)) {
d1 <- dist(ts[[i]]);
if (!identical(NA, adj) & length(adj)==length(ts)) d1 <- adj[i]*d1;
d0 <- d0+d1;
};
d0 <- d0/length(ts);
};
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.