random-seed

Which R packages use some kind of random process when attached? [closed]

雨燕双飞 提交于 2019-12-14 02:33:40
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . A follow-up to this question: Why would an R package load random numbers? I wonder if there's a way to generate a list of all packages that include some kind of random process when attached. 回答1: I do not know of a way to be absolutely certain you've made an exhaustive list. However, we can check all of the

Random Seed Chose Different Rows

笑着哭i 提交于 2019-12-13 23:57:21
问题 I was applying .sample with random_state set to a constant and after using set_index it started selecting different rows. A member dropped that was previously included in the subset. I'm unsure how seeding selects rows. Does it make sense or did something go wrong? Here is what was done: df.set_index('id',inplace=True, verify_integrity=True) df_small_F = df.loc[df['gender']=='F'].apply(lambda x: x.sample(n=30000, random_state=47)) df_small_M = df.loc[df['gender']=='M'].apply(lambda x: x

How to find out which seed the MICE R-package chose for multiple imputation when using seed=NA?

空扰寡人 提交于 2019-12-13 19:17:54
问题 I´m doing a multiple imputation for a dataframe named "mydata" with this code: library(mice) imp<-mice(mydata,pred=pred,method="pmm", m=10) Because the default argument for this is function is "seed=NA", the seed-number is chosen randomly. I would like to keep it like this, because i don´t know which number i should choose as a seed. But for replication i would like to know which seed this function chose for me. Is there a possibility to inspect the mids-object "imp" for the seed-value? Or

Batch random function giving same first output

我怕爱的太早我们不能终老 提交于 2019-12-13 06:54:48
问题 In my batch program, I have this line in the middle of it: set /a scramble=%random% The problem here is that everytime I open the batch file, it gives me the same output, for example I open it and it sets %scramble% to 17534, the next time I open it, it is very similar, for example 17546, increasing by a small amount. If I loop it, then only the first random number is similar, all the rest are random. For example The first time I run it, it gives me this list of numbers: 23486,32645,4854 the

MySQL RAND() seed values almost repeat

元气小坏坏 提交于 2019-12-12 18:35:07
问题 Using MySQL 5.6.21 on Windows 7. I am attempting to return a 'random' row from a table seeded by the date (so the same row returns for the current day and then switches the next day etc - a "random quote of the day generator" if you like). I noticed the same rows keep coming up so I simplified the query to its basics, it appears the RAND() function generates very similar numbers every fourth seed value. When rounded to an integer the values appear to repeat every fourth seed. This example

How to select a repeatable random number with setseed in postgres sql?

*爱你&永不变心* 提交于 2019-12-12 17:29:31
问题 What I am trying to achieve is selecting a control group for a process. To do this I am using random(), and for debugging / consistency I would like to be able to set the random number in a repeatable fashion. Meaning, I run the query once it assigns user 123 random number .001. At a different time I delete the previous data, I call the same query, and once again user 123 is assigned random number .001. I have tried: SELECT setseed(0); SELECT 1, random() from generate_series(1,10); I receive

Weird behavior of using set.seed multiple times

人走茶凉 提交于 2019-12-12 12:07:50
问题 I came up with a strange result when doing my homework in R, can anyone explain to me what's going on? The instruction told me to set seed 1 to keep consistency. At first, I set seed(1) twice set.seed(1) x <- rnorm(100, mean = 0, sd = 1) set.seed(1) epsilon <- rnorm(100, mean = 0, sd = 0.25) y <- 0.5 * x + epsilon -1 plot(x,y,main = "Scatter plot between X and Y", xlab = "X", ylab = "Y") I get scatter plot like this: The plot with two set seed After I only use one set seed the code is: set

Can I have multiple independent random number generators in R like I can in C++?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 10:56:53
问题 I have many independent random processes (arrival processes say) that require me to generate random numbers. I want to use common random numbers for each of these processes that I can compare how different policies perform when controlling these policies. I want Process A to be governed by Generator A (using seed A) I want Process B to be governed by Generator B (using seed B) .. and so on. Is this possible to implement in R. I can't find anyone who has done it. I have tried. Forgive me if

Difference between Python 2 and 3 for shuffle with a given seed

只谈情不闲聊 提交于 2019-12-12 08:43:00
问题 I am writing a program compatible with both Python 2.7 and 3.5. Some parts of it rely on stochastic process. My unit tests use an arbitrary seed, which leads to the same results across executions and languages... except for the code using random.shuffle . Example in Python 2.7: In[]: import random random.seed(42) print(random.random()) l = list(range(20)) random.shuffle(l) print(l) Out[]: 0.639426798458 [6, 8, 9, 15, 7, 3, 17, 14, 11, 16, 2, 19, 18, 1, 13, 10, 12, 4, 5, 0] Same input in

Structuring a Keras project to achieve reproducible results in GPU

谁都会走 提交于 2019-12-12 07:07:24
问题 I am writing a tensorflow.Keras wrapper to perform ML experiments. I need my framework to be able to perform an experiment as specified in a configuration yaml file and run in parallel in a GPU. Then I need a guarantee that if I ran the experiment again I would get if not the exact same results something reasonably close. To try to ensure this, my training script contains these lines at the beginning, following the guidelines in the official documentation: # Set up random seeds random.seed