np.linspace()
主要用来创建等差数列
numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)
start:返回样本数据开始点
stop:返回样本数据结束点
num:生成的样本数据量,默认为50
endpoint:True则包含stop;False则不包含stop
retstep:If True, return (samples, step), where step is the spacing between samples.(即如果为True则结果会给出数据间隔)
dtype:输出数组类型
axis:0(默认)或-1
np.random.normal()
是一个正态分布
numpy.random.normal(loc=0,scale=1e-2,size=shape)
参数loc(float):正态分布的均值
参数scale(float):正态分布的标准差
参数size(int 或者整数元组):输出的值赋在shape里,默认为None
np.round()
返回浮点数x的四舍五入值
np.r_;np.c_
np.r_是按列连接两个矩阵,就是把两矩阵上下相加,要求列数相等。
np.c_是按行连接两个矩阵,就是把两矩阵左右相加,要求行数相等。
plt.figure()
figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True)
num:图像编号或名称,数字为编号 ,字符串为名称
figsize:指定figure的宽和高,单位为英寸;
dpi参数指定绘图对象的分辨率,即每英寸多少个像素,缺省值为80 1英寸等于2.5cm,A4纸是 21*30cm的纸张
facecolor:背景颜色
edgecolor:边框颜色
frameon:是否显示边框
np.ones()
返回一个全1的n维数组