2

我尝试T-sneR. 我想使用 dtw 而不是欧几里得距离。如何更改规格R

对精选数据执行算法

library(Rtsne)

tsne <- Rtsne(train[,-1], dims = 2, perplexity=30, verbose=TRUE, max_iter = 500)
tSNE
exeTimeTsne<- system.time(Rtsne(train[,-1], dims = 2, perplexity=30, verbose=TRUE, max_iter = 500))
4

1 回答 1

1

您可以Rtsne使用您选择的方法提供任何距离矩阵,并将is_distance标志设置为TRUE. 有关详细信息,请参阅提供预先计算的距离部分?Rtsne

library(Rtsne)
library(vegan)

df = data.frame(A = c(4, 11, 17, 0, 2, 4, 8, 10, 2, 4),
                B = c(6, 10, 7, 2, 21, 3, 3, 0, 2, 17),
                C = c(5, 2, 3, 12, 12, 14, 0, 7, 8, 2),
                D = c(7, 16, 24, 18, 31, 8, 2, 21, 3, 13))


bc <- vegdist(df, method = "bray")
tSNE <- Rtsne(bc, is_distance = TRUE, dims = 2, perplexity = 2, verbose = TRUE, max_iter = 500)
于 2019-07-08T15:04:27.897 回答