将高斯噪声应用于值列表
对于从列表中选择样本,我希望使用数学分布,其中样本总数固定,St = 1000,并且有 5 个桶,以便初始分布是均匀的。样本 = [200, 200, 200, 200, 200] 我希望添加随机高斯噪声,平均值为 0 和统一类别权重的 20% 作为标准差,但样本总数仍应为 1000。
这是我当前的代码块
signal = np.array([200, 200, 200, 200, 200])
print('total samples: ', sum(signal))
noise = np.random.normal(0,0.2,5)
print('noise generated: ',noise)
val = (signal*noise)
val = np.round(val,0)
val = val+signal
print(val)
print('samples after weighted distribution: ',sum(val))
我想要应用权重但仍将样本总数保持为 1000。我该如何处理?
For sample selection from a list, I wish to use a mathematical distribution where the total number of samples is fixed, St = 1000 and there are 5 buckets such that the initial distribution is uniform. samples = [200, 200, 200, 200, 200]
I wish to add random Gaussian noise with mean 0 and 20% of uniform class weight as standard deviation, but the total number of samples should still be 1000.
This is my current code block
signal = np.array([200, 200, 200, 200, 200])
print('total samples: ', sum(signal))
noise = np.random.normal(0,0.2,5)
print('noise generated: ',noise)
val = (signal*noise)
val = np.round(val,0)
val = val+signal
print(val)
print('samples after weighted distribution: ',sum(val))
I want to apply weights but still maintain the total number of samples as 1000. How do I go about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论