Rtsne
和tsne
,这里我使用前者。# load packages
library(Rtsne)
# Generate Training Data: random standard normal matrix with J=400 variables and N=100 observations
x.train <- matrix(nrom(n=40000, mean=0, sd=1), nrow=100, ncol=400)
# Generate Test Data: random standard normal vector with N=1 observation for J=400 variables
x.test <- rnorm(n=400, mean=0, sd=1)
# perform t-SNE
set.seed(1)
fit.tsne <- Rtsne(X=x.train, dims=2)
命令 fit.tsne$Y
将返回包含数据的 t-SNE 表示的 (100x2) 维对象;也可以通过 plot(fit.tsne$Y)
进行绘制。
问题:现在,我正在寻找一个函数,它可以基于训练好的 t-SNE 模型对我的测试数据返回一个 (1x2) 维度的预测值 pred
。类似于:
# The function I am looking for (but doesn't exist yet):
pred <- predict(object=fit.tsne, newdata=x.test)
这是否可能?你能帮我解决这个问题吗?