[英]a question about the seed of np.random.permutation
I'm trying to shuffle my data along the first axis.我正在尝试沿第一个轴打乱我的数据。 The code is as following:代码如下:
shuffle_indexes = np.random.permutation(new_data.shape[0])
new_data = new_data[shuffle_indexes]
I wanna set a random seed to the function in order to replicate the result and control variables.我想为 function 设置一个随机种子,以复制结果和控制变量。 But I check the official website and I didn't find such parameters for the function.但是查了官网,没有找到function的参数。 How can I solve this problem?我怎么解决这个问题?
numpy.random.seed(0)
Sets the seed.设置种子。
In your specific case you can also short the code to shuffle the array using在您的特定情况下,您还可以缩短代码以使用
numpy.random.shuffle(array)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.