http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html

#np.random.normal,产生制定分布的数集
#http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html
# mean and standard deviation
# 均值的物理意义mu,Mean (“centre”) of the distribution.
# 方差的物理意义sigma,Standard deviation (spread or “width”) of the distribution
import numpy as np

mu, sigma = 0, 0.1
s = np.random.normal(mu, sigma, 1000)

#验证均值和方差,是否和随机生成的一样
print(abs(mu - np.mean(s)) < 0.01)
print(abs(sigma - np.std(s, ddof=1)) < 0.01) #ddof不知道什么意思

import matplotlib.pyplot as plt

count, bins, ignored = plt.hist(s, 10, normed=True)
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *np.exp( - (bins - mu)**2 / (2 * sigma**2) ),linewidth=2, color='r')
plt.show()

numpy.random.normal

numpy.random.normal(loc=0.0, scale=1.0, size=None)

Draw random samples from a normal (Gaussian) distribution.

The probability density function of the normal distribution, first derived by De Moivre and 200 years later by both Gauss and Laplace independently [R250], is often called the bell curve because of its characteristic shape (see the example below).

The normal distributions occurs often in nature. For example, it describes the commonly occurring distribution of samples influenced by a large number of tiny, random disturbances, each with its own unique distribution [R250].

Parameters:

loc : float

Mean (“centre”) of the distribution.

scale : float

Standard deviation (spread or “width”) of the distribution.

size : int or tuple of ints, optional

Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

#np.random.normal,产生制定分布的数集(默认是标准正态分布)相关推荐

  1. 如何区分np.random.normal()、np.random.randn()、np.random.randint()、np.random.random()、np.random.choice()

    本期我们来对np.random中常用的函数进行区分 np.random.normal(loc,scale,size) 参数说明: loc:正太分布的均值 scale:正太分布的标准差 size:设定数 ...

  2. numpy库常用函数——np.random.normal()函数

    一.函数语法: np.random.normal(loc=0.0, scale=1.0, size=None) 参数解释: loc(float):此概率分布的均值(对应着整个分布的中心centre s ...

  3. 【numpy】np.random.normal()函数

    [汇总]numpy里的一些函数 np.random.normal() https://blog.csdn.net/lanchunhui/article/details/50163669 numpy.r ...

  4. 从np.random.normal()到正态分布的拟合

    先看伟大的高斯分布(Gaussian Distribution)的概率密度函数(probability density function): f(x)=12π−−√σexp(−(x−μ)22σ2) f ...

  5. np.random.normal()的含义及实例

    这是个随机产生正态分布的函数.(normal 表正态) 先看一下官方解释: 有三个参数, loc:正态分布的均值,对应着这个分布的中心.代表下图的 μ \mu μ scale:正态分布的标准差,对应分 ...

  6. np.random.normal()函数

    这是的np是numpy包的缩写,np.random.normal()的意思是一个正态分布,normal这里是正态的意思.我在看孪生网络的时候看到这样的一个例子:numpy.random.normal( ...

  7. 2020-10-22从np.random.normal()到正态分布的拟合

    先看伟大的高斯分布(Gaussian Distribution)的概率密度函数(probability density function): f(x)=12π‾‾‾√σexp(−(x−μ)22σ2)f ...

  8. Python学习之np.random.normal()函数

    这是的np是numpy包的缩写,np.random.normal()的意思是一个正态分布,normal这里是正态的意思.我在看孪生网络的时候看到这样的一个例子:numpy.random.normal( ...

  9. np.random.normal()详解

    import numpy as np np.random.normal()的意思是一个正态分布 normal------>正态 例子: noise = np.random.normal(loc= ...

最新文章

  1. java.lang.ClassNotFoundException: Didn't find class org.apache.http.Protoco
  2. 测试开发人员与开发人员_如何升级为开发人员
  3. php正则表达式判断url,判断url的正则表达式
  4. AI部署前路坎坷,50%项目半路夭折
  5. 安装和使用VCLSkin美肤插件
  6. jvm(8)-虚拟机字节码执行引擎
  7. Linux无root权限安装cuda9.1和cudnn7.05以及编译框架时无lcuda.so的问题
  8. WPF在一个窗口中实现多个视图
  9. docker 数据卷 mysql_Docker 数据卷
  10. 阮工的单片机编程经验集:如何做稳定单片机程序与上位机程序防卡顿,js等经验;阮丁远于20221111
  11. 低代码平台上的出入库管理
  12. 《毁灭杀手》(kkrieger)
  13. 中国电信php,一个基于中国电信开放应用平台的短信发送函数(PHP版)
  14. php计算一年多少周,同时计算出这一周的开始时间和结束时间(可选返回时间戳或日期)
  15. 分块算法板子luogu1903
  16. 一小时搭建实时数据分析平台
  17. 重启tomcat命令
  18. 第四十一篇 指令中的VNode
  19. 怎样修改git用户名、密码和邮箱?
  20. iOS开发-进阶:被误解的MVC和被神化的MVVM(作者:唐巧)

热门文章

  1. 人脸识别争议再起 实际应用利弊几何?
  2. 深层上下文化的单词表示
  3. 谈谈机器学习的基本问题,不谈数学!
  4. Kubernetes的未来是虚拟机?
  5. 谷歌工程师:聊一聊深度学习的weight initialization
  6. python中若干关于类的问题
  7. (以pytorch为例)路径(深度)的正则化方法的简单理解-drop path
  8. 人工智能皇冠上的明珠:自然语言处理简介、最新进展、未来趋势
  9. VR/AR行业发展至今,它的市场规模如何
  10. L2级自动驾驶量产趋势解读