Skip to content
This repository has been archived by the owner on Dec 30, 2017. It is now read-only.

Results not reproducible #4

Open
mattmotoki opened this issue Jun 16, 2017 · 5 comments
Open

Results not reproducible #4

mattmotoki opened this issue Jun 16, 2017 · 5 comments

Comments

@mattmotoki
Copy link

Hi,
The documentation suggests that reproducible results can be achieved by setting the seed in R. This works for the original Rtsne function, but it doesn't seem to work for Rtsne.multicore.

library(Rtsne.multicore)

iris_unique <- unique(iris)
mat <- as.matrix(iris_unique[,1:4])

# repeat calculation
set.seed(42)
tsne_out1 <- Rtsne.multicore(mat)

set.seed(42)
tsne_out2 <- Rtsne.multicore(mat)

# plot results
plot(tsne_out1$Y, col=iris_unique$Species, main="first run")
plot(tsne_out2$Y, col=iris_unique$Species, main="second run")

first run
second run

@gfinak
Copy link
Member

gfinak commented Jun 16, 2017 via email

@mattmotoki
Copy link
Author

Thanks for the suggestion.

@gfinak
Copy link
Member

gfinak commented Jun 16, 2017

Perhaps I spoke too soon, I believe we can fix the seed on this implementation.

@gfinak gfinak reopened this Jun 16, 2017
@mattmotoki
Copy link
Author

Okay great. It's not a big issue for me, but thank you for the useful package.

@gfinak
Copy link
Member

gfinak commented Jun 16, 2017

Need to initialize the random number generator with a different, but deterministic seed via srand() inside the #pragma omp parallel block of tsne.cpp.
Ideally we'd like to either pass in the seed via the R function wrapper or use one of R's random generators so that set.seed calls in R have the expected effect.

mikejiang pushed a commit that referenced this issue Jun 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants