将高斯噪声应用于值列表

发布于 2025-01-10 00:32:55 字数 647 浏览 2 评论 0原文

对于从列表中选择样本,我希望使用数学分布,其中样本总数固定,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))

enter image description here

I want to apply weights but still maintain the total number of samples as 1000. How do I go about this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文