You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first thanks for the great package, it makes dealing with MS data much simpler.
I was just exploring the different methods for imputing missing values, when I discovered that to my surprise impute(msnset, "knn") fixes the seed value.
suppressPackageStartupMessages(library(MSnbase))
data(msnset)
# Other methods show the expected behaviorfor(iin1:10){
tmp<-MSnbase::impute(msnset, "zero")
print(rnorm(1))
}
#> [1] 2.077938#> [1] -0.3538495#> [1] 1.269365#> [1] 0.1198152#> [1] -0.07994367#> [1] -1.107776#> [1] 0.5004011#> [1] -0.7553048#> [1] -1.225024#> [1] 0.2958373# Fixes the seed, so no more randomness afterwardsfor(iin1:10){
tmp<-MSnbase::impute(msnset, "knn")
print(rnorm(1))
}
#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527#> [1] -0.668527
I saw that internally it is actually not your package that calls set.seed(), but the impute::impute.knn() method, but the method returns the state of the random number generator. So I was wondering if you could reset the rng state after the method call? If you are currently busy I could also try to make a small PR.
Best, Constantin
The text was updated successfully, but these errors were encountered:
Hi Laurent,
first thanks for the great package, it makes dealing with MS data much simpler.
I was just exploring the different methods for imputing missing values, when I discovered that to my surprise
impute(msnset, "knn")
fixes the seed value.Created on 2018-11-15 by the reprex package (v0.2.1)
I saw that internally it is actually not your package that calls
set.seed()
, but theimpute::impute.knn()
method, but the method returns the state of the random number generator. So I was wondering if you could reset the rng state after the method call? If you are currently busy I could also try to make a small PR.Best, Constantin
The text was updated successfully, but these errors were encountered: