#网址 http://docs.scipy.org/doc/numpy/reference/generated/numpy.matlib.randn.html#numpy.matlib.randn

numpy.matlib.randn

numpy.matlib.randn(*args)[source]

Return a random matrix with data from the “standard normal” distribution.

randn generates a matrix filled with random floats sampled from a univariate “normal” (Gaussian) distribution of mean 0 and variance 1.

Parameters:

*args : Arguments

Shape of the output. If given as N integers, each integer specifies the size of one dimension. If given as a tuple, this tuple gives the complete shape.

Returns:

Z : matrix of floats

A matrix of floating-point samples drawn from the standard normal distribution.

See also

rand, random.randn

Notes

For random samples from , use:

sigma * np.matlib.randn(...) + mu

Examples

>>>

>>> import numpy.matlib
>>> np.matlib.randn(1)
matrix([[-0.09542833]]) #random
>>> np.matlib.randn(1, 2, 3) #和np.matlib.randn( 2, 3)产生相同的效果,不知道为什么要加1,另外不能产生维度更高的,比如np.matlib.randn( 2, 3,4)系统会报错
matrix([[ 0.16198284, 0.0194571 , 0.18312985],
[-0.7509172 , 1.61055 , 0.45298599]]) #random

Two-by-four matrix of samples from : #这点非常重要,知道如何产生其它方差和均值的分布; 2.5*2.5=6.25

>>>

>>> 2.5 * np.matlib.randn((2, 4)) + 3
matrix([[ 4.74085004, 8.89381862, 4.09042411, 4.83721922],
[ 7.52373709, 5.07933944, -2.64043543, 0.45610557]]) #random

Previous topic

numpy.matlib.rand

Next topic

Miscellaneous routines

numpy.matlib.randn(标准正态分布)的更多相关文章

  1. numpy.random.randn()与numpy.random.rand()的区别(转)

    numpy中有一些常用的用来产生随机数的函数,randn()和rand()就属于这其中. numpy.random.randn(d0, d1, …, dn)是从标准正态分布中返回一个或多个样本值. n ...

  2. numpy.random.randn()与rand()的区别【转】

    本文转载自:https://blog.csdn.net/u010758410/article/details/71799142 numpy中有一些常用的用来产生随机数的函数,randn()和rand( ...

  3. 【转】numpy.random.randn()与rand()的区别

    转自: https://blog.csdn.net/u010758410/article/details/71799142 numpy中有一些常用的用来产生随机数的函数,randn()和rand()就 ...

  4. numpy.random.randn()和numpy.random.rand()

    1 numpy.random.rand() (1)numpy.random.rand(d0,d1,…,dn) rand函数根据给定维度生成[0,1)之间的数据,包含0,不包含1 dn表格每个维度 返回 ...

  5. [转]numpy.random.randn()用法

    在python数据分析的学习和应用过程中,经常需要用到numpy的随机函数,由于随机函数random的功能比较多,经常会混淆或记不住,下面我们一起来汇总学习下. import numpy as np ...

  6. numpy.random.randn()与numpy.random.rand()的区别

    numpy中有一些常用的用来产生随机数的函数,randn()和rand()就属于这其中. numpy.random.randn(d0, d1, …, dn)是从标准正态分布中返回一个或多个样本值. n ...

  7. C语言产生标准正态分布或高斯分布随机数

    C语言 产生标准正态分布或高斯分布 随机数 产生正态分布或高斯分布的三种方法: 1. 运用中心极限定理(大数定理) #include #include #define NSUM 25 double g ...

  8. 标准正态分布表(scipy.stats)

    0. 标准正态分布表与常用值 Z-score 是非标准正态分布标准化后的 x即 z=x−μσ" role="presentation">z=x−μσz=x−μσ 表 ...

  9. T 分布(近似标准正态分布)

    1.1      定义 定义:假设X服从标准正态分布N(0,1),Y服从卡方分布,那么的分布称为自由度为n的t分布,记为. T分布密度函数其中,Gam(x)为伽马函数. 可用于两组独立计量资料的假设检 ...

随机推荐

  1. json遍历

    $.each(item.attributes,function (name,value) { });

  2. python 安装anaconda, numpy, pandas, matplotlib 等

    如果没安装anaconda,则这样安装这些库: pip install numpy pip install pandas pip install matplotlib sudo apt-get ins ...

  3. python实例1:创建一个登陆模块

    实现功能: 1.用户输入账户密码 2.验证账户是否存在于黑名单,如果存在于黑名单,则执行1,否则往下执行 3.验证用户名和密码. 3.1.如果验证成功,则打印欢迎信息并退出程序: 3.2.如果用户名存 ...

  4. Python 面试题(下)

    接上篇. 网络 1 三次握手 客户端通过向服务器端发送一个SYN来创建一个主动打开,作为三路握手的一部分.客户端把这段连接的序号设定为随机数 A. 服务器端应当为一个合法的SYN回送一个SYN/ACK ...

  5. Nginx启动与停止

    参考:https://www.phusionpassenger.com/library/install/nginx/install/oss/rubygems_rvm/ Starting Nginx Y ...

  6. CentOS取消屏幕保护自动锁屏功能

    CentOS系统在用户闲置一段时间(默认为5分钟)后,会启动屏幕保护程序(默认的屏保为黑屏),并要求重新输入密码才能回到原来的桌面. 设置屏幕保护:System -> Preferences - ...

  7. 怎么在js里写html

    <html> <head> <meta charset="utf-8"/> <title>示例前端模板写在代码里</title ...

  8. 3.07课·········if分支语句

    语句分类:顺序语句,选择语句(分支语句),循环语句 分支语句:(一)if(表达式) //表达式返回值是True或False{}说明:1.表达式返回的是bool值:2.小括号和花括号后面不需要加分号. ...

  9. DNS 原理入门 (转)

    DNS 是互联网核心协议之一.不管是上网浏览,还是编程开发,都需要了解一点它的知识. 本文详细介绍DNS的原理,以及如何运用工具软件观察它的运作.我的目标是,读完此文后,你就能完全理解DNS. 一.D ...

  10. Spark MLlib框架详解

    1. 概述 1.1 功能 MLlib是Spark的机器学习(machine learing)库,其目标是使得机器学习的使用更加方便和简单,其具有如下功能: ML算法:常用的学习算法,包括分类.回归.聚 ...